# The syzygy distinguisher

Hugues Randriambololona

► To cite this version:

Hugues Randriambololona. The syzygy distinguisher. EUROCRYPT 2025: The 44th Annual International Conference on the Theory and Applications of Cryptographic Techniques, The International Association for Cryptologic Research (IACR), May 2025, Madrid, Spain. pp.324-354, 10.1007/978-3-031-91095-1_12. hal-05053501

HAL Id: hal-05053501

https://telecom-paris.hal.science/hal-05053501v1

Submitted on 2 May 2025

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 Attribution 4.0 International License
# The syzygy distinguisher

(Eurocrypt 2025 version, expanded, with supplementary material and errata)

Hugues Randriambololona

ANSSI, Laboratoire de cryptographie
& Télécom Paris, C²

huguesrandriam@ssi.gouv.fr

**Abstract.** We present a new distinguisher for alternant and Goppa codes, whose complexity is subexponential in the error-correcting capability, hence better than that of generic decoding algorithms. Moreover it does not suffer from the strong regime limitations of the previous distinguishers or structure recovery algorithms: in particular, it applies to the codes used in the *Classic McEliece* candidate for postquantum cryptography standardization. The invariants that allow us to distinguish are graded Betti numbers of the homogeneous coordinate ring of a shortening of the dual code.

Since its introduction in 1978, this is the first time an analysis<fnref n="1" /> of the McEliece cryptosystem breaks the exponential barrier.

# 1 Introduction

In the McEliece cryptosystem [21], a private message is encoded as a codeword in a public binary Goppa code [14], with some noise added. Knowing the secret algebraic data that served to construct the public code, the legitimate recipient has an efficient decoding algorithm and can recover the message. However, to an attacker, the public code looks like a random code, and removing the noise is untractable.

Slightly more formally, a traditional security proof for the system relies on two assumptions:

1. Goppa codes are computationally indistinguishable from generic linear codes (say, when described by generator matrices in reduced row echelon form).

2. Decoding a generic linear code is difficult.

Cryptanalytic attempts can be classified depending on whether they target assumption 1 or 2.

First, those aiming at assumption 1 themselves come in two flavours:

- *Distinguishers* address the decisional version of the problem: given a generator matrix, decide whether it is that of a Goppa code or a generic code.

- *Key recovery attacks* address the computational version: recover the Goppa structure of the code, or at least an equivalent one [13], if it exists.

<footnote n="1">¹ we exclude results such as [28] that use an attack model for which direct countermeasures exist</footnote>
Although certain arguments, such as the fact that the class of Goppa codes is
very large, make assumption 1 plausible, it remains quite ad hoc from a theoreti-
cal point of view. Its sole virtue is that it passed the test of time. There seems to
be something special with Goppa codes happening there: indeed, variants of the
McEliece system were proposed, with Goppa codes replaced with other types of
codes allowing more manageable parameters; however, most of these propositions
were eventually broken, as the hidden structure of the codes could be recovered.
Also, although the McEliece cryptosystem marked the birth of code-based cryp-
tography, the idea of having an object (such as a Goppa code) constructed from
data defined over an extension field and then masked by considering it over a
small subfield, was then found in other branches of cryptography: for instance it
is at the basis of the HFE cryptosystem [24] in multivariate cryptography. Such
systems can often be attacked by algebraic methods (including, but not limited
to, the use of Gröbner basis algorithms). This suggests that if a weakness in
assumption 1 were to be uncovered one day, then algebraic methods should be
a tool of choice. However, up to now, the best distinguishers and key recovery
algorithms such as those in [12][8][7][1] only apply to alternant or Goppa codes
with very degraded parameters. Against McEliece with cryptographically rele-
vant parameters, either they have exponential complexity with large constants,
which makes them useless, or worse: they simply cease to work.

Assumption 2, on the other hand, stands on a firm theoretical ground: the
decoding problem for generic linear codes is known to be NP-hard [2]. As such, it
is believed to resist the advent of quantum computers, which made the McEliece
system a good candidate for postquantum cryptography. However, starting with
Prange's information set decoding algorithm [25], generic decoding methods
saw continuous incremental improvements over time. Joint with technological
progress in computational power, this eventually led to practical *message recovery attacks* against the McEliece system with its initially proposed parameter
set. However, it appears that this weakness was only the result of a too optimistic
choice of parameters. With the need for new standards for postquantum cryptography, an updated version named *Classic McEliece* was proposed, still relying
on binary Goppa codes, but with more conservative parameter sets adapted to
resist the best generic decoding attacks with some margin of safety. In the design
rationale of this new system [4] one can find an impressive list of several dozens
of papers on generic decoding algorithms, ranging over the last five decades. It
is then observed that all these algorithms have complexity exponential in the
error-correcting capability of the code. Better, the constant in this exponential
is still the same as in Prange's original result: all improvements remain confined
in terms of lesser order! This might give a feeling that we could possibly have
reached the intrinsic complexity of cryptanalysis of this system.

Invalidating this belief, we present a new distinguisher for alternant and
Goppa codes, i.e. a basic structural analysis of the McEliece cryptosystem, whose
asymptotic complexity is subexponential in the error-correcting capability, hence
better than that of generic decoding algorithms. Moreover, for given finite pa-
rameters, it is more efficient than state-of-the-art distinguishers or key recovery
methods, while not suffering from their strong regime limitations: in particular, it applies to the codes used in Classic McEliece.

## Principles and organization

A natural strategy to build a distinguisher is to design code invariants — quantities that intrinsically depend only on the code, not on the choice of a generator matrix — that behave differently for the classes of codes we want to distinguish. The invariants we use here are graded Betti numbers of the homogeneous coordinate ring of a shortening of the dual code. Generators of the dual of an alternant or Goppa code, after extension of scalars, satisfy quadratic relations of a special form: they can be expressed as $2 \times 2$ minors of a matrix. As such, we can find relations between these quadratic relations, called syzygies. Then these syzygies also satisfy relations, and iterating this process we get higher syzygies up to some order that we can estimate. However, for generic codes, we do not expect this to happen in the same magnitude. This directly gives a distinguisher, at least in theory. In practice, computing these spaces of syzygies only involves basic linear algebra: they can be constructed iteratively, as the kernel of some generalized Macaulay matrices. This can be done efficiently, except for the fact that the dimension of the spaces involved grows exponentially. Our last ingredient is then shortening, which allows us to work with syzygies of a lesser order, and keep these dimensions more under control.

Let us quickly illustrate our result with two basic examples.

First, our distinguisher can be seen as a generalization of the so-called square code distinguisher, first presented in [12], reinterpreted in [20], and fully analyzed in [22]. Let $C$ be a $[n, k]$-code, and $S_2$ the space of quadratic forms in $k$ indeterminates. Let

$$ ev_2 : S_2 \to \mathbb{F}^n \qquad (1) $$

be the evaluation map at the columns of a given generator matrix of $C$. Then the image of $ev_2$ is the square code $C^{(2)}$, and its kernel is the space of quadratic relations $I_2(C)$. The dimensions of these spaces are related, and can be expressed as a Betti number:

$$ \beta_{1,2}(C) = \dim(I_2(C)) = \binom{k+1}{2} - \dim(C^{(2)}). \qquad (2) $$

Now [12] gives a lower bound on this $\beta_{1,2}(C)$ when $C$ is the dual of an alternant or (binary) Goppa code. On the other hand, [3] shows $\beta_{1,2}(C) = (\binom{k+1}{2} - n)^+$ with high probability when $C$ is random. If this quantity is smaller than the said lower bound, we can distinguish.

Likewise we claim that Theorem 2.8 of [10] provides a $\beta_{2,3}$-based distinguisher for GRS codes among [7, 4]-codes,<fnref n="2" /> where we restrict to codes whose square is the whole space — otherwise we can use the square distinguisher. For such a

<footnote n="2">² erratum: among MDS [7, 4]-codes (which then implies of full square)</footnote>
code we always have $\dim(I_2(C)) = (4^2+1) - 7 = 3$. Let $Q_1, Q_2, Q_3$ be a basis of $I_2(C)$. By definition, $Q_1, Q_2, Q_3$ do not satisfy linear relations with coefficients in $\mathbb{F}$, however they can satisfy relations whose coefficients are forms of degree 1. Such relations are also called degree 3 syzygies. They live in the kernel of the degree 3 Macaulay matrix

$$ M_3 : I_2(C) \otimes S_1 \to S_3 \qquad (3) $$

where $S_1$ (resp. $S_3$) is the space of homogeneous linear (resp. cubic) forms in $k = 4$ variables. Now Theorem 2.8 of [10] shows that for a non-GRS code the map $M_3$ is injective. On the other hand, if $C$ is GRS with standard basis $y, yx, yx^2, yx^3$ then we can take

$$ Q_1 = X_1X_3 - X_2^2, \quad Q_2 = X_1X_4 - X_2X_3, \quad Q_3 = X_2X_4 - X_3^2 \qquad (4) $$

and these satisfy the syzygies

$$ X_1Q_3 - X_2Q_2 + X_3Q_1 = X_2Q_3 - X_3Q_2 + X_4Q_1 = 0. \qquad (5) $$

Thus we can distinguish by computing $\beta_{2,3}(C) = \dim \ker(M_3)$, which will yield 2 for GRS and 0 for non-GRS [7, 4]-codes.

We generalize these examples to higher Betti numbers, following the exact same pattern:

- On one hand, we give lower bounds on the Betti numbers of algebraic codes (dual alternant, dual Goppa, and their shortened subcodes). This is done in section 3, using the Eagon-Northcott complex, a tool precisely crafted to detect long conjugate GRS subcodes.

- On the other hand, we estimate the Betti numbers of random codes in terms of raw code parameters (length, dimension, distance). This is done in section 4, partially relying on a natural heuristic: random codes are not expected to admit more syzygies than those forced by these parameters. We do not have full proofs for this fact, but we provide experimental evidence and partial theoretical arguments that support it.

Prior to that, section 2 explains how these invariants can be effectively computed. Last, section 5 combines everything and chooses parameters in order to optimize asymptotic complexity. Of special importance in this regard is Proposition 4, which shows that the property that the ideal of a code contains minors of a matrix of linear forms passes to its shortened subcodes.

## Related (and unrelated) works

As already noted, our distinguisher can be seen as a generalization of the square distinguisher of [12]. Using an approach similar to ours, the work [7] also extends this square distinguisher by exploiting special properties of the space of quadratic relations, but in a different direction. Last, the key recovery attack in [1] combines shortening of the dual code with ideas from the square distinguisher, and a
careful algebraic modeling in order to apply tools from Gröbner basis theory. All these results have limited range of applicability, but they introduced numerous techniques that influenced the present work.

From a geometric point of view, the Betti numbers and the syzygies we consider are those of a set of points in projective space (namely, defined by the columns of a parity check matrix of the code). As such, they have been already extensively studied. Of notable importance to us are the works [15][19][17][11], in relation with the so-called minimal resolution conjecture — regardless of it being false in general: we just request it being “true enough”. Initially, syzygies of sets of points were considered as a mere tool in the study of syzygies of curves. They were then studied for themselves, but the focus was mostly on points in generic position, over an algebraically closed field. Keeping applications to coding theory and cryptography in mind, we will have more interest in finite field effects.

Syzygies sometimes appear as a tool in cryptanalytic works, or in the study of Gröbner basis algorithms; however in general only the first module of syzygies is considered, not those of higher order. Likewise, a few works in coding theory (such as [27] or [16]) use homological properties of finite sets of points; but the applications differ from ours.

Last, note that our approach is apparently unrelated to the series of works initiated with [18]: while these authors also define Betti numbers for codes, these are constructed from the Stanley-Reisner ring of the code matroid, not the homogeneous coordinate ring. This leads to different theories, although seeking links between the two could be an interesting project.

## Notation and conventions

We use row vector convention. We try to consistently use lowercase bold font for codewords and vectors: **c**, **x**, **y**; uppercase bold for matrices: **G**, **H**, **M**; sans-serif for codes: **C**, **GRS**, **Alt**, **Gop**.

The book [10] will be our main source on syzygies. For codes, especially the link between powers of codes and the geometric view on coding theory, we will follow [26].

Given a field $\mathbb{F}$, we see $\mathbb{F}^n$ as the standard product algebra of dimension $n$. Thus $\mathbb{F}^n$ is not a mere vector space, it comes canonically equipped with componentwise multiplication: for $\mathbf{x} = (x_1, \dots, x_n)$ and $\mathbf{y} = (y_1, \dots, y_n)$ in $\mathbb{F}^n$,

$$ \mathbf{x}\mathbf{y} = (x_1y_1, \dots, x_ny_n). \qquad (6) $$

(Some authors call this the Schur product of $\mathbf{x}$ and $\mathbf{y}$; how the name of this great mathematician ended associated with this trivial operation is quite *convoluted*.)

In any algebra, we can define a trace bilinear form. In the case of $\mathbb{F}^n$, this trace bilinear form is the standard scalar product:

$$ \langle \mathbf{x}, \mathbf{y} \rangle = x_1y_1 + \dots + x_ny_n. \qquad (7) $$

A $k$-dimensional subspace $C \subseteq \mathbb{F}^n$ is called a $[n, k]$-code (and a $[n, k]_q$-code in case $\mathbb{F} = \mathbb{F}_q$). The orthogonal space $C^\perp$ is called the *dual code* of $C$.
Componentwise multiplication extends to codes, taking the linear span: for $\mathbb{C}, \mathbb{C}' \subseteq \mathbb{F}^n$,

$$ \mathbb{C}\mathbb{C}' = \langle \mathbb{C}\mathbb{C}' : \mathbf{c} \in \mathbb{C}, \mathbf{c}' \in \mathbb{C}' \rangle_{\mathbb{F}}. \qquad (8) $$

Powers $\mathbb{C}^{\langle r \rangle}$ of a code are defined inductively: $\mathbb{C}^{\langle 0 \rangle} = \mathbb{F} \cdot \mathbf{1}$ is the 1-dimensional repetition code, and $\mathbb{C}^{\langle r+1 \rangle} = \mathbb{C}^{\langle r \rangle} \mathbb{C}$.

If $\mathbb{C}$ is a $[n, k]$-code, a generator matrix for $\mathbb{C}$ is a $k \times n$ matrix $\mathbf{G}$ whose rows $\mathbf{c}_1, \dots, \mathbf{c}_k$ form a basis of $\mathbb{C}$. A parity check matrix $\mathbf{H}$ for $\mathbb{C}$ is a generator matrix for $\mathbb{C}^{\perp}$.

Thanks to the algebra structure, polynomials in one or several variables can be evaluated in $\mathbb{F}^n$. In particular, let

$$ S = \mathbb{F}[X_1, \dots, X_k] \qquad (9) $$

be the algebra of polynomials in $k$ variables over $\mathbb{F}$, graded by total degree. Evaluation at the rows $\mathbf{c}_1, \dots, \mathbf{c}_k$ of $\mathbf{G}$ then gives linear map

$$ \mathrm{ev}_{\mathbb{G}} : S \to \mathbb{F}^n. \qquad (10) $$

Observe that if $\mathbf{p}_1, \dots, \mathbf{p}_n$ are the columns of $\mathbf{G}$, then for $f(X_1, \dots, X_k) \in S$ we have

$$ \mathrm{ev}_{\mathbb{G}}(f) = f(\mathbf{c}_1, \dots, \mathbf{c}_k) \qquad (11) \\ = (f(\mathbf{p}_1), \dots, f(\mathbf{p}_n)) $$

where in the first line we have one evaluation of $f$ at a $k$-tuple of vectors, while in the second line we have a vector of evaluations of $f$ at $k$-tuples of scalars.

A code is projective if it has dual minimum distance $d_{\min}(\mathbb{C}^{\perp}) \ge 3$, or equivalently if no two of the $\mathbf{p}_i$ are proportional. Any code can be “projectivized” by discarding (puncturing) coordinates, keeping only one $\mathbf{p}_i$ in each nonzero proportionality class.

Restricting to homogeneous polynomials of degree $r$, we have a surjective map $S_r \to \mathbb{C}^{\langle r \rangle}$, whose kernel we denote $I_r(\mathbb{C})$. We then define the homogeneous coordinate ring of $\mathbb{C}$ as the formal direct sum

$$ \mathbb{C}^{\langle r \rangle} = \bigoplus_{r \ge 0} \mathbb{C}^{\langle r \rangle} \qquad (12) $$

and likewise its homogeneous ideal

$$ I(\mathbb{C}) = \bigoplus_{r \ge 0} I_r(\mathbb{C}). \qquad (13) $$

It turns out these are also the homogeneous coordinate ring and the homogeneous ideal of the finite set of points

$$ \{\mathbf{p}_1, \dots, \mathbf{p}_n\} \subseteq \mathbf{P}^{k-1}. \qquad (14) $$

The short exact sequence

$$ 0 \to I(\mathbb{C}) \to S \to \mathbb{C}^{\langle r \rangle} \to 0 \qquad (15) $$
makes $C^{\langle\rangle}$ a homogeneous quotient ring of $S$. In this work we will use coordinates, but identifying $S$ with the symmetric algebra of $C$ would allow to make all this coordinatefree.

Given $\mathbf{x}, \mathbf{y} \in \mathbb{F}^n$, all entries of $\mathbf{x}$ distinct, all entries of $\mathbf{y}$ nonzero, the generalized Reed-Solomon code of order $k$ with support vector $\mathbf{x}$ and multiplier $\mathbf{y}$ is

$$ \mathrm{GRS}_k(\mathbf{x}, \mathbf{y}) = \langle \mathbf{y}, \mathbf{y}\mathbf{x}, \dots, \mathbf{y}\mathbf{x}^{k-1} \rangle_{\mathbb{F}} = \{\mathbf{y}f(\mathbf{x}) : f(X) \in \mathbb{F}[X]_{<k}\} \subseteq \mathbb{F}^n. \quad (16) $$

It is a $[n, k]$-code if $k \le n$.

Now let $\mathbb{F}_q \subseteq \mathbb{F}_{q^m}$ be an extension of finite fields. Given $\mathbf{x}, \mathbf{y} \in (\mathbb{F}_{q^m})^n$ satisfying the same conditions as above, the *alternant code* of order $t$ and extension degree $m$ over $\mathbb{F}_q$, with support $\mathbf{x}$ and multiplier $\mathbf{y}$, is

$$ \begin{aligned} \mathrm{Alt}_t(\mathbf{x}, \mathbf{y}) &= \mathrm{GRS}_t(\mathbf{x}, \mathbf{y})^{\perp} \cap (\mathbb{F}_q)^n \\ &= \{\mathbf{c} \in (\mathbb{F}_q)^n : c_1 y_1 x_1^j + \dots + c_n y_n x_n^j = 0 \quad (0 \le j < t)\}, \end{aligned} \quad (17) $$

with parameters $[n, (\ge)n - mt]_q$.

Last, given a polynomial $g(X) \in \mathbb{F}_{q^m}[X]$ that does not vanish on any entry of $\mathbf{x}$, the $q$-ary *Goppa code* with support $\mathbf{x}$ and Goppa polynomial $g$ is

$$ \mathrm{Gop}(\mathbf{x}, g) = \mathrm{Alt}_{\mathrm{deg}(g)}(\mathbf{x}, g(\mathbf{x})^{-1}). \quad (18) $$

We will work mostly in the class

$$ \mathrm{Alt}_{q,m,n,t}^{\perp} \quad (19) $$

of *dual $q$-ary alternant codes* of extension degree $m$, length $n$, and order $t$. If $q$ is unspecified we take $q=2$. If $n$ is unspecified we take $n=q^m$. We say a code $C \in \mathrm{Alt}_{q,m,n,t}^{\perp}$ is *proper* if it has dimension

$$ k = mt. \quad (20) $$

In this case, after extension of scalars, we have

$$ C_{\mathbb{F}_{q^m}} = \mathrm{GRS}_t(\mathbf{x}, \mathbf{y}) \oplus \mathrm{GRS}_t(\mathbf{x}^q, \mathbf{y}^q) \oplus \dots \oplus \mathrm{GRS}_t(\mathbf{x}^{q^{m-1}}, \mathbf{y}^{q^{m-1}}). \quad (21) $$

Likewise we define the corresponding class

$$ \mathrm{Gop}_{q,m,n,t}^{\perp} \quad (22) $$

of dual Goppa codes, and $C \in \mathrm{Gop}_{q,m,n,t}^{\perp}$ is said proper if it is when seen in $\mathrm{Alt}_{q,m,n,t}^{\perp}$. Also we define subclasses $\mathrm{Gop}_{q,m,n,t}^{\mathrm{irr},\perp} \subseteq \mathrm{Gop}_{q,m,n,t}^{\mathrm{sqfr},\perp} \subseteq \mathrm{Gop}_{q,m,n,t}^{\perp}$, in which the Goppa polynomial is irreducible or squarefree, respectively.
## 2 Minimal resolutions and graded Betti numbers

### Generalities

We freely borrow results and terminology from [10], and then elaborate on the parts of the theory that we will need.

Let $S = \mathbb{F}[X_1, \dots, X_k]$ be the $k$-dimensional polynomial ring over $\mathbb{F}$, graded by total degree. If $M_0$ is a finitely generated graded $S$-module, and $F_0$ is the free module on a minimal system of homogeneous generators of $M_0$, then the (first) syzygy module of $M_0$ is $M_1 = \ker(F_0 \to M_0)$. Concretely, if $g_1, \dots, g_N$ are minimal generators of $M_0$, elements of $F_0$ can be seen as formal sums $\sum_u f_u [g_u]$ with $f_u \in S$, where the $[g_u]$ are just formal symbols; such a formal sum then lies in $M_1$ when the actual sum evaluated in $M_0$ satisfies $\sum_u f_u g_u = 0$.

Iterating this construction, we obtain a minimal resolution

$$ \dots \to F_2 \to F_1 \to F_0 \qquad (23) $$

of $M_0$, where the graded free modules $F_i$, together with the iterated syzygy modules $M_i$, are constructed inductively:

- $F_i$ is the free module on a minimal system of homogeneous generators of $M_i$

- $M_{i+1} = \ker(F_i \to M_i)$.

The number $\beta_{i,j}$ of degree $j$ elements in a minimal system of generators of $M_i$ does not depend on the choices made, and is called the $(i, j)$-th graded Betti number of $M_0$. Keeping track of the grading, we have

$$ F_i = \bigoplus_{j \ge 0} S(-j)^{\beta_{i,j}} \qquad (24) $$

where $S(-j)$ is the free rank 1 module generated in degree $j$, so $S(-j)_d = S_{d-j}$.

It is customary to display the graded Betti numbers in the form of a Betti diagram, as follows:

<table><thead><tr><th></th><th>0</th><th>1</th><th>...</th><th>i</th><th>...</th></tr></thead><tbody><tr><th>...</th><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr><tr><th>r</th><td>β<sub>0,r</sub></td><td>β<sub>1,r+1</sub></td><td>...</td><td>β<sub>i,r+i</sub></td><td>...</td></tr><tr><th>r + 1</th><td>β<sub>0,r+1</sub></td><td>β<sub>1,r+2</sub></td><td>...</td><td>β<sub>i,r+i+1</sub></td><td>...</td></tr><tr><th>...</th><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr></tbody></table>

with null entries marked as “-” for readability.

**Lemma 1.** Assume $M_i$ is generated in degrees $\ge D$, i.e. $\beta_{i,j} = 0$ for all $j \le D-1$. Then $M_{i+1}$ is generated in degrees $\ge D+1$, and by induction all the upper-right quadrant of the Betti diagram defined by $\beta_{i,D-1}$ vanishes.
*Proof.* Let $g_1, \dots, g_N$ form a minimal system of generators of $M_i$. By hypothesis all $g_u$ have degree $\ge D$. Then, in a homogeneous relation $\sum_u f_u g_u = 0$, no $f_u$ can be a nonzero constant: otherwise the corresponding $g_u$ could be expressed as a linear combination of the others, hence could be removed from the system of generators, contradicting minimality. Thus all nonzero $f_u$ have degree $\ge 1$, and the element of $M_{i+1}$ defined by this homogeneous relation has degree $\ge D+1$.

As $M_i$ and $F_i$ are graded $S$-modules, we will also write $M_{i,j}$ and $F_{i,j}$ for their degree $j$ homogeneous components.

From now on let $\mathcal{C}$ be a $[n,k]$-code, with generator matrix $\mathbf{G}$, and $M_0 = \mathcal{C}^{\langle\cdot\rangle}$ its homogeneous coordinate ring. Then $M_0$ is a dimension 1 Cohen-Macaulay quotient of $\mathcal{S}$, and by the Auslander-Buchsbaum formula its minimal resolution has length $k-1$. So we have an exact sequence

$$0 \to F_{k-1} \to \dots \to F_2 \to F_1 \to F_0 = S \to \mathcal{C}^{\langle\cdot\rangle} \to 0 \quad (25)$$

and the Betti diagram has $k$ columns, indexed from 0 to $k-1$.

As $M_0 = \mathcal{C}^{\langle\cdot\rangle}$ and $F_0 = S$, we have $\beta_{0,0} = 1$ and $\beta_{0,j} = 0$ for $j \ne 0$, i.e. the 0-th column of the Betti diagram is always $(1, -, -, \dots)^{\top}$.

Likewise $M_1 = I(\mathcal{C})$, and $\beta_{1,j}$ is the number of homogeneous polynomials of degree $j$ in a minimal system of generators of $I(\mathcal{C})$. As the evaluation map $S_1 \to \mathcal{C}$ is an isomorphism, we see that $I(\mathcal{C})$ is generated in degrees $\ge 2$. Lemma 1 then implies:

**Lemma 2.** For any $i \ge 1$, the $i$-th syzygy module $M_i$ of $\mathcal{C}$ is generated in degrees $\ge i+1$. Thus we have $F_{i,j} = M_{i,j} = 0$ for $j \le i$, and

$$F_{i,i+1} = M_{i,i+1} = \mathbb{F}^{\beta_{i,i+1}}. \quad (26)$$

Hence the 0-th row of the Betti diagram is always $(1, -, -, \dots)$.

Figures 1-3 offer a few such diagrams for contemplation.

<table><caption>**Fig. 1.** the $[7, 4]_2$ Hamming code</caption><thead><tr><th></th><th>0</th><th>1</th><th>2</th><th>3</th></tr></thead><tbody><tr><th>0</th><td>1</td><td>-</td><td>-</td><td>-</td></tr><tr><th>1</th><td>-</td><td>3</td><td>-</td><td>-</td></tr><tr><th>2</th><td>-</td><td>1</td><td>6</td><td>3</td></tr></tbody></table>

<table><caption>**Fig. 2.** the $[11, 6]_3$ Golay code</caption><thead><tr><th></th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th></tr></thead><tbody><tr><th>0</th><td>1</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><th>1</th><td>-</td><td>10</td><td>16</td><td>-</td><td>-</td><td>-</td></tr><tr><th>2</th><td>-</td><td>1</td><td>5</td><td>26</td><td>20</td><td>5</td></tr></tbody></table>

<table><caption>**Fig. 3.** the $[23, 12]_2$ Golay code</caption><thead><tr><th></th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>10</th><th>11</th></tr></thead><tbody><tr><th>0</th><td>1</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><th>1</th><td>-</td><td>55</td><td>320</td><td>891</td><td>1408</td><td>1210</td><td>320</td><td>55</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><th>2</th><td>-</td><td>1</td><td>11</td><td>55</td><td>220</td><td>650</td><td>1672</td><td>1870</td><td>1221</td><td>485</td><td>110</td><td>11</td></tr></tbody></table>

Observe that replacing $\mathbf{G}$ with $\mathbf{SG}$, for $\mathbf{S} \in \mathbb{F}^{k \times k}$ an invertible matrix, corresponds to a linear change of coordinates for the variables $X_1, \dots, X_k$. This is an
automorphism of $S$, hence will not affect the Betti numbers. Thus these Betti numbers really are invariants of $C$, independently of the choice of $G$.

More generally recall that two $[n, k]$ codes $C_1, C_2$, defined by generator matrices $G_1, G_2$, are linearly isometric, or monomially equivalent, if $G_1 = SG_2PD$ for $S \in \mathbb{F}^{k \times k}$ an invertible matrix, and $P, D \in \mathbb{F}^{n \times n}$ a permutation matrix and an invertible diagonal matrix.

**Lemma 3.** *Monomially equivalent codes have the same Betti numbers.*

*Proof.* We already discussed the action of $S$. As for the action of $PD$, it preserves the kernel of the graded evaluation map $S \to C^{(\cdot)}$.

## Effective computation

There are several algorithms to compute minimal resolutions and graded Betti numbers in general. Many of them rely first on a Gröbner basis computation. However in this work we will only be interested in computing the first (nontrivial) row of the Betti diagram, or equivalently, the so-called *linear strand* of the resolution. This easier computation can be described in elementary terms. First, for any $r \ge 3$, consider the natural multiplication map

$$ \varphi_r : M_{r-2,r-1} \otimes S_1 \to M_{r-2,r}. \qquad (27) $$

**Lemma 4.** *We have:*

$$ \ker(\varphi_r) = M_{r-1,r} \simeq \mathbb{F}^{\beta_{r-1,r}} \qquad (28) $$

$$ \mathrm{coker}(\varphi_r) \simeq \mathbb{F}^{\beta_{r-2,r}}. \qquad (29) $$

*Proof.* We prove (29) first. Let $\mathcal{G}$ be a minimal system of homogeneous generators of $M_{r-2}$, and for each $j$ let $B_{r-2,j} \subseteq M_{r-2,j}$ be the linear subspace generated by the degree $j$ elements of $\mathcal{G}$. Then, as $M_{r-2}$ is generated in degrees $\ge r-1$, we have $B_{r-2,r-1} = M_{r-2,r-1}$, and $B_{r-2,r}$ is a complementary subspace to $S_1 \cdot B_{r-2,r-1} = \mathrm{im}(\varphi_r)$ in $M_{r-2,r}$. This proves (29).

Now let $F_{r-2}$ be the free graded module on $\mathcal{G}$. Then $M_{r-1,r}$ is the kernel of the natural map $F_{r-2,r} \to M_{r-2,r}$. However, under the decompositions $F_{r-2,r} = (B_{r-2,r-1} \otimes S_1) \oplus B_{r-2,r}$ and $M_{r-2,r} = \mathrm{im}(\varphi_r) \oplus B_{r-2,r}$, this natural map decomposes as $\varphi_r \oplus \mathrm{id}_{B_{r-2,r}}$. This proves (28).

This readily gives a coarse upper bound on the $\beta_{r-1,r}$:

**Lemma 5.** We have $\beta_{1,2} \le \frac{k(k-1)}{2}$, and $\beta_{r-1,r} \le (k-1)\beta_{r-2,r-1}$ for $r \ge 3$. Hence $\beta_{r-1,r}(C) \le \frac{k}{2}(k-1)^{r-1}$ for any $r \ge 2$.

*Proof.* We have $\dim(C^{(2)}) \ge \dim(C) = k$ hence $\beta_{1,2} = \binom{k+1}{2} - \dim(C^{(2)}) \le \frac{k(k-1)}{2}$. Now let $r \ge 3$. As $M_{r-2}$ is a submodule of the free module $F_{r-3}$, multiplication by $X_1$ is injective on $M_{r-2}$. Hence $M_{r-2,r-1} \simeq X_1 M_{r-2,r-1} \subseteq \mathrm{im}(\varphi_r)$ from which it follows $\beta_{r-1,r} = k\beta_{r-2,r-1} - \dim \mathrm{im}(\varphi_r) \le (k-1)\beta_{r-2,r-1}$.
**Proposition 1.** The $M_{r-1,r}$ can be computed iteratively as follows. For $r = 3$:

$$M_{2,3} = \ker(I_2(\mathbb{C}) \otimes S_1 \to S_3) \qquad (30)$$

where $I_2(\mathbb{C}) \otimes S_1 \to S_3$ is the natural multiplication map. Then for $r \ge 4$:

$$M_{r-1,r} = \ker(M_{r-2,r-1} \otimes S_1 \to M_{r-3,r-2} \otimes S_2) \qquad (31)$$

where the map $\psi_r: M_{r-2,r-1} \otimes S_1 \to M_{r-3,r-2} \otimes S_2$ is obtained first by tensoring the inclusion $M_{r-2,r-1} \subseteq M_{r-3,r-2} \otimes S_1$ by $S_1$, and then composing with the multiplication map $S_1 \otimes S_1 \to S_2$.

*Proof.* First, (30) is just the case $r = 3$ of (28), composed with the inclusion $I_3(\mathbb{C}) \subseteq S_3$. Likewise to prove (31) we must show $\ker(\varphi_r) = \ker(\psi_r)$ for $r \ge 4$. For this we just observe that the diagram

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

commutes, with the two arrows on the right injective.

Thus we have two descriptions of $M_{r-1,r}$. The description $M_{r-1,r} = \ker(\varphi_r)$ is closer to the abstract definition, and will be used later to estimate the value of the Betti numbers. The description $M_{r-1,r} = \ker(\psi_r)$ is more amenable to effective computation.

**Corollary 1.** The $M_{r-1,r}(\mathbb{C})$ only depend on $I_2(\mathbb{C})$.

To make things entirely explicit we now introduce the following matrices. Assume $\mathbb{C}$ is given by a generator matrix $\mathbf{G} \in \mathbb{F}^{k \times n}$, with rows $\mathbf{c}_1, \dots, \mathbf{c}_k$. Choose monomial bases $\mathcal{M}_1 = (X_a)_{1 \le a \le k}$, $\mathcal{M}_2 = (X_a X_b)_{1 \le a \le b \le k}$, and $\mathcal{M}_3 = (X_a X_b X_c)_{1 \le a \le b \le c \le k}$ of $S_1, S_2, S_3$, ordered with respect to some monomial order.

**Definition 1.** The squared matrix of $\mathbf{G}$ is the matrix

$$\mathbf{M}_2 \in \mathbb{F}^{\binom{k+1}{2} \times n} \qquad (33)$$

with rows indexed by $\mathcal{M}_2$: the row corresponding to $X_a X_b$ is $\mathbf{c}_a \mathbf{c}_b$.

Then $I_2(\mathbb{C})$ is the left kernel of $\mathbf{M}_2$, and we choose a basis $\mathcal{B}_2$ of this space. Thus $\mathcal{B}_2$ consists of $\beta_{1,2}$ vectors, each of which has its entries indexed by $\mathcal{M}_2$.

**Definition 2.** The degree 3 Macaulay matrix of $\mathcal{B}_2$ is the matrix

$$\mathbf{M}_3 \in \mathbb{F}^{k\beta_{1,2} \times \binom{k+2}{3}} \qquad (34)$$

with rows indexed by $\mathcal{M}_1 \times \mathcal{B}_2$ and columns indexed by $\mathcal{M}_3$: the row corresponding to $(X_a, \mathbf{q}) \in \mathcal{M}_1 \times \mathcal{B}_2$, where $\mathbf{q} = (q_M)_{M \in \mathcal{M}_2}$, has entry $q_M$ at position corresponding to $X_a M \in \mathcal{M}_3$, and 0 elsewhere.
(Said otherwise, the rows of $\mathbf{M}_3$ are formed by multiplying all $\mathbf{q} \in \mathcal{B}_2$, seen as quadratic forms $\mathbf{q} = \sum_{1 \le b \le c \le k} q_{X_b X_c} X_b X_c$, by all variables $X_a$.)

Then by (30), $M_{2,3}$ is the left kernel of $\mathbf{M}_3$, and we choose a basis $\mathcal{B}_3$ of this space. Thus $\mathcal{B}_3$ consists of $\beta_{2,3}$ vectors, each of which has its entries indexed by $M_1 \times B_2$.

Now let $r \ge 4$, and assume inductively for all $3 \le i \le r - 1$ we have constructed a basis $\mathcal{B}_i$ of $M_{i-1,i}$, consisting of $\beta_{i-1,i}$ vectors, each of which has its entries indexed by $M_1 \times B_{i-1}$.

**Definition 3.** The degree $r$ blockwise Macaulay matrix of $\mathcal{B}_{r-1}$, $\mathcal{B}_{r-2}$ is the matrix

$$ \mathbf{M}_r \in \mathbb{F}^{k\beta_{r-2,r-1} \times \binom{k+1}{2}\beta_{r-3,r-2}} \quad (35) $$

with rows indexed by $M_1 \times \mathcal{B}_{r-1}$ and columns indexed by $M_2 \times \mathcal{B}_{r-2}$: the row corresponding to $(X_a, \mathbf{s}) \in M_1 \times \mathcal{B}_{r-1}$, where $\mathbf{s} = (s_{X_b, \mathbf{t}})_{X_b \in M_1, \mathbf{t} \in \mathcal{B}_{r-2}}$, has entry $s_{X_b, \mathbf{t}}$ at position corresponding to $(X_a X_b, \mathbf{t}) \in M_2 \times \mathcal{B}_{r-2}$, and 0 elsewhere.

(Said otherwise, the rows of $\mathbf{M}_r$ are formed by multiplying all $\mathbf{s} \in \mathcal{B}_{r-1}$ by all variables $X_a$, where each $\mathbf{s}$ is seen as a formal sum $\mathbf{s} = \sum_{\mathbf{t} \in \mathcal{B}_{r-2}} L_{\mathbf{t}}[\mathbf{t}]$ whose coefficients are linear forms $L_{\mathbf{t}} = \sum_{1 \le b \le k} s_{X_b, \mathbf{t}} X_b$, resulting in formal sums $X_a \mathbf{s} = \sum_{\mathbf{t} \in \mathcal{B}_{r-2}} (X_a L_{\mathbf{t}})[\mathbf{t}]$ whose coefficients are quadratic forms.)

Then by (31), $M_{r-1,r}$ is the left kernel of $\mathbf{M}_r$, and we proceed.

All this is summarized in Algorithm 1.

<caption>**Algorithm 1** Compute bases $\mathcal{B}_r$ of $M_{r-1,r}(\mathcal{C})$ up to some degree $D$</caption>

**Input:** — a generator matrix $\mathbf{G}$ of the $[n, k]$-code $\mathcal{C}$
— a target degree $D \le k$
1: **construct** the matrix $\mathbf{M}_2$ according to Definition 1
2: **compute** a left kernel basis $\mathcal{B}_2$ of $\mathbf{M}_2$
3: **construct** the matrix $\mathbf{M}_3(\mathcal{B}_2)$ according to Definition 2
4: **compute** a left kernel basis $\mathcal{B}_3$ of $\mathbf{M}_3$
5: **for** $r = 4 \dots D$ **do**
6: &nbsp;&nbsp;&nbsp;&nbsp;**construct** the matrix $\mathbf{M}_r(\mathcal{B}_{r-1}, \mathcal{B}_{r-2})$ according to Definition 3
7: &nbsp;&nbsp;&nbsp;&nbsp;**compute** a left kernel basis $\mathcal{B}_r$ of $\mathbf{M}_r$
8: **end for**

Observe that our computation only relies on mere linear algebra, and does not make use of any Gröbner basis theory. However, the two topics are clearly related. In particular, the many linear algebra optimizations used in Gröbner basis algorithms could certainly apply in our context.

## Further properties

We will have a particular interest in the length of the linear strand, or equivalently, in the following quantity:
**Definition 4.** For a linear code C, we set

$$r_{\max}(C) = \max\{r : \beta_{r-1,r}(C) > 0\}. \qquad (36)$$

As the minimal resolution of a $[n, k]$-code C has length $k - 1$, we always have $r_{\max}(C) \le k$.

Sometimes we only control the syzygies of certain subideals of $I(C)$, and from these we want to deduce information on the syzygies of the whole ideal. Intuitively, we expect that syzygies between elements of the subideals could be seen as syzygies between elements of the ideal. Of course this fails in general, but it remains true if we restrict to the linear strand:

**Proposition 2.** Let $M$ be a finite $S$-module generated in degrees $\ge d_0$, and suppose its degree $d_0$ part $M_{d_0}$ decomposes as a direct sum

$$M_{d_0} = A_{d_0} \oplus B_{d_0}. \qquad (37)$$

Let $A = \langle A_{d_0} \rangle_S$ and $B = \langle B_{d_0} \rangle_S$ be the sub-$S$-modules of $M$ generated by $A_{d_0}$ and $B_{d_0}$. Let $\widehat{M}$ be the (first) syzygy module of $M$, and $\widehat{A}$ and $\widehat{B}$ those of $A$ and $B$. Then we have a natural inclusion

$$\widehat{A}_{d_0+1} \oplus \widehat{B}_{d_0+1} \subseteq \widehat{M}_{d_0+1} \qquad (38)$$

the cokernel of which identifies with $A_{d_0+1} \cap B_{d_0+1}$, hence a (non-canonical) isomorphism

$$\widehat{M}_{d_0+1} \simeq \widehat{A}_{d_0+1} \oplus \widehat{B}_{d_0+1} \oplus (A_{d_0+1} \cap B_{d_0+1}). \qquad (39)$$

*Proof.* We have surjective maps

$$(A_{d_0} \oplus B_{d_0}) \otimes S_1 \to A_{d_0+1} \oplus B_{d_0+1} \to A_{d_0+1} + B_{d_0+1} \qquad (40)$$

with $\widehat{A}_{d_0+1} \oplus \widehat{B}_{d_0+1}$ the kernel of the leftmost map, $A_{d_0+1} \cap B_{d_0+1}$ the kernel of the rightmost map, and $\widehat{M}_{d_0+1}$ the kernel of the composite map. We conclude with the associated kernel-cokernel exact sequence.

**Corollary 2.** Suppose $I_2(C)$ contains a certain direct sum of $l$ subspaces:

$$I_2(C) \supseteq V^{(1)} \oplus \cdots \oplus V^{(l)}. \qquad (41)$$

Then the minimal resolution of $C^{(\langle r \rangle)}$ canonically admits the direct sum of the linear strands of the minimal resolutions of $S/\langle V^{(1)} \rangle, \dots, S/\langle V^{(l)} \rangle$ as a subcomplex. In particular for all $r \ge 2$ we have

$$\beta_{r-1,r}(C) \ge \beta_{r-1,r}(S/\langle V^{(1)} \rangle) + \dots + \beta_{r-1,r}(S/\langle V^{(l)} \rangle). \qquad (42)$$

*Proof.* Apply Proposition 2 repeatedly.

Recall that $\pi C$ is a punctured code of $C$ if it is obtained from $C$ by discarding some given set of coordinates (equivalently, discarding some subset of the associated set of points in projective space).
**Corollary 3.** Let $\pi\mathcal{C}$ be a punctured code of $\mathcal{C}$. Assume $\dim(\pi\mathcal{C}) = \dim(\mathcal{C})$. Then for all $r \ge 2$ we have

$$ \beta_{r-1,r}(\pi\mathcal{C}) \ge \beta_{r-1,r}(\mathcal{C}) \qquad (43) $$

hence

$$ r_{\max}(\pi\mathcal{C}) \ge r_{\max}(\mathcal{C}). \qquad (44) $$

*Proof.* Let $S = \mathbb{F}[X_1, \dots, X_k]$ where $k = \dim(\pi\mathcal{C}) = \dim(\mathcal{C})$. Then the surjective map $S \to (\pi\mathcal{C})^{\langle\cdot\rangle}$ factors through $\mathcal{C}^{\langle\cdot\rangle}$, so that $I_2(\pi\mathcal{C}) \supseteq I_2(\mathcal{C})$.

Last, the following easy result is also useful:

**Lemma 6.** Minimal resolutions are preserved under extension of scalars. In particular if a code $\mathcal{C}$ is defined over $\mathbb{F}$, and if $\mathbb{F} \subseteq \mathbb{K}$ is a field extension, then $\beta_{i,j}(\mathcal{C}) = \beta_{i,j}(\mathcal{C}_{\mathbb{K}})$ for all $i, j$.

# 3 Lower bounds from the Eagon-Northcott complex

## Generalities

Let $R$ be a ring, and for integers $f \ge g$, temporarily switching to column vector convention, let $\mathbf{\Phi} \in R^{g \times f}$ define a linear map

$$ \mathbf{\Phi}: F = R^f \to G = R^g. \qquad (45) $$

The Eagon-Northcott complex [9] of $\mathbf{\Phi}$ is the following complex of $R$-modules, defined in terms of the exterior and (dual of) symmetric powers of $F$ and $G$:

$$ 0 \to (\mathrm{Sym}^{f-g} G)^{\vee} \otimes \bigwedge^f F \to \dots \to G^{\vee} \otimes \bigwedge^{g+1} F \to \bigwedge^g F \xrightarrow{\wedge^g \mathbf{\Phi}} \bigwedge^g G \simeq R. \qquad (46) $$

Under mild hypotheses, this complex is exact [10, Th. A.2.60 & Th. 6.4], so it defines a resolution of the quotient $R/\mathrm{im}(\bigwedge^g \mathbf{\Phi})$ defined by the ideal generated by the maximal minors of $\mathbf{\Phi}$.

In this work we will only need the case $g = 2$. In this case the complex has length $f - 1$, and for $2 \le r \le f$ its $(r-1)$-th module is free of rank

$$ \mathrm{rk} \left( (\mathrm{Sym}^{r-2} G)^{\vee} \otimes \bigwedge^r F \right) = (r-1) \binom{f}{r}. \qquad (47) $$

All this can be made explicit, in coordinates. Let

$$ \mathbf{\Phi} = \begin{pmatrix} x_1 & x_2 & \dots & x_f \\ x'_1 & x'_2 & \dots & x'_f \end{pmatrix} \qquad (48) $$

for $x_i, x'_i \in R$. Then:
$$ q_{i,j} = x_i x'_j - x_j x'_i \qquad (49) $$

for $1 \le i < j \le f$,

$$ \begin{array}{l} \text{– these } q_{ij} \text{ are annihilated by the } 2\binom{f}{3} \text{ relations} \\ r_{ijk} = x_i q_{jk} - x_j q_{ik} + x_k q_{ij} \\ r'_{ijk} = x'_i q_{jk} - x'_j q_{ik} + x'_k q_{ij} \end{array} \qquad (50) $$

for $1 \le i < j < k \le f$,

$$ \begin{array}{l} \text{– these } r_{ijk} \text{ and } r'_{ijk} \text{ are annihilated by the } 3\binom{f}{4} \text{ relations} \\ s_{ijkl} = x_i r_{jkl} - x_j r_{ikl} + x_k r_{ijl} - x_l r_{ijk} \\ s'_{ijkl} = x_i r'_{jkl} - x_j r'_{ikl} + x_k r'_{ijl} - x_l r'_{ijk} + \\ \qquad x'_i r_{jkl} - x'_j r_{ikl} + x'_k r_{ijl} - x'_l r_{ijk} \\ s''_{ijkl} = x'_i r'_{jkl} - x'_j r'_{ikl} + x_k r'_{ijl} - x_l r'_{ijk} \end{array} \qquad (51) $$

for $1 \le i < j < k < l \le f$,

and so on. These are just the cases $r = 2, 3, 4$ of the more general:

**Proposition 3.** In the multivariate polynomial ring

$$ R[Z_{r; i_1, \dots, i_r}^{(j)}] \qquad (52) $$

where, for each $2 \le r \le f$, indices range over the $(r-1)\binom{f}{r}$ values $1 \le j \le r-1$ and $1 \le i_1 < \dots < i_r \le f$, construct polynomials $s_{r; i_1, \dots, i_r}^{(j)}$ as follows. First for $r = 2$ we define the constant polynomials

$$ s_{2; i_1, i_2}^{(1)} = x_{i_1} x'_{i_2} - x'_{i_1} x_{i_2} \qquad (53) $$

given by the minors of $\Phi$; and for $r \ge 3$ we define linear polynomials

$$ s_{r; i_1, \dots, i_r}^{(j)} = \sum_{u=1}^{r} (-1)^{u-1} (x_{i_u} Z_{r-1; i_1, \dots, \hat{i}_u, \dots, i_r}^{(j)} + x'_{i_u} Z_{r-1; i_1, \dots, \hat{i}_u, \dots, i_r}^{(j-1)}) \quad (54) $$

where notation $\hat{i}_u$ means $i_u$ is omitted, and we replace $Z_{r; i_1, \dots, i_r}^{(j)}$ with zero if $j \le 0$ or $j \ge r$. Then, for all $r \ge 3$, we have

$$ \mathbf{s}_r(\mathbf{s}_{r-1}) = \mathbf{0}. \qquad (55) $$

*Proof.* Either express (46) in the standard bases of $F = R^f$ and $G = R^2$. Or more directly, consider the $\mathbf{Z}_r$ and $\mathbf{s}_r$ as $(r-1)$-tuples of (exterior) $r$-vectors, observe that (53) means $\mathbf{s}_2^{(1)} = \mathbf{x} \wedge \mathbf{x}'$, that (54) means $\mathbf{s}_r^{(j)} = \mathbf{x} \wedge \mathbf{Z}_{r-1}^{(j)} + \mathbf{x}' \wedge \mathbf{Z}_{r-1}^{(j-1)}$, so the alternating property gives $\mathbf{s}_3^{(1)}(\mathbf{s}_2) = \mathbf{x} \wedge \mathbf{x} \wedge \mathbf{x}' = \mathbf{0}$, $\mathbf{s}_3^{(2)}(\mathbf{s}_2) = \mathbf{x}' \wedge \mathbf{x} \wedge \mathbf{x}' = \mathbf{0}$, and for $r \ge 4$:

$$ \begin{aligned} \mathbf{s}_r^{(j)}(\mathbf{s}_{r-1}) = \mathbf{x} \wedge \mathbf{x} \wedge \mathbf{Z}_{r-2}^{(j)} &+ \mathbf{x} \wedge \mathbf{x}' \wedge \mathbf{Z}_{r-2}^{(j-1)} + \\ &+ \mathbf{x}' \wedge \mathbf{x} \wedge \mathbf{Z}_{r-2}^{(j-1)} + \mathbf{x}' \wedge \mathbf{x}' \wedge \mathbf{Z}_{r-2}^{(j-2)} = \mathbf{0}. \end{aligned} \qquad (56) $$
Shortening (or projection from a point)

We have interest in how this Eagon-Northcott complex interacts with reduc-
tion to a subcode, and in particular with shortening. By induction it suffices to
consider the case of a codimension 1 subcode, or a 1-shortening respectively.

So let $\mathcal{C}$ be a $[n, k]$-code over $\mathbb{F}$, and $\mathcal{C}_{\mathcal{H}}$ a codimension 1 subcode. We will assume $\mathcal{C}$ projective, but then $\mathcal{C}_{\mathcal{H}}$ need not be so. Choose a basis $\mathbf{c}_1, \dots, \mathbf{c}_{k-1}$ of $\mathcal{C}_{\mathcal{H}}$, and complete it to a basis $\mathbf{c}_1, \dots, \mathbf{c}_k$ of $\mathcal{C}$. Let $\mathbf{G}_{\mathcal{H}}$ and $\mathbf{G}$ be the corresponding generating matrices of $\mathcal{C}_{\mathcal{H}}$ and $\mathcal{C}$. Let also $S = \mathbb{F}[X_1, \dots, X_k]$ be the polynomial ring in $k$ indeterminates, and $S_{\mathcal{H}} = \mathbb{F}[X_1, \dots, X_{k-1}]$ its subring in the first $k-1$ indeterminates. We have a commutative diagram

$$
\begin{tikzcd}
S_{\mathcal{H}} \arrow[r] \arrow[d] & C_{\mathcal{H}}^{(\langle \cdot \rangle)} \arrow[d] \\
S \arrow[r] & C^{(\langle \cdot \rangle)}
\end{tikzcd}
\qquad (57)
$$

where horizontal maps denote evaluation, and vertical maps inclusion. Also set

$$
\mathcal{H} = S_{\mathcal{H},1} = \langle X_1, \dots, X_{k-1} \rangle_{\mathbb{F}} \subseteq S_1 \quad (58)
$$

and let $\mathbf{p}_{\mathcal{H}} = (0 : \cdots : 0 : 1)^{\top} \in \mathbf{P}^{k-1}$ be the associated point. Last, let $\{\mathbf{p}_1, \dots, \mathbf{p}_n\} \subseteq \mathbf{P}^{k-1}$ be the set of points defined by the columns of $\mathbf{G}$. Then we have two possibilities:

- Either $\mathbf{c}_1, \dots, \mathbf{c}_{k-1}$ all vanish at some common position $i$, or equivalently, $\mathbf{p}_{\mathcal{H}} = \mathbf{p}_i$. Puncturing this position, we can identify $\mathcal{C}_{\mathcal{H}}$ with the 1-shortened subcode of $\mathcal{C}$ at $i$. Then the set of points in $\mathbf{P}^{k-2}$ defined by the columns of $\mathbf{G}_{\mathcal{H}}$ is the image of $\{\mathbf{p}_1, \dots, \hat{\mathbf{p}}_i, \dots, \mathbf{p}_n\}$ under the projection from $\mathbf{p}_i$.

- Otherwise, if there is no such $i$, then $\mathcal{C}_{\mathcal{H}}$ is a “general” codimension 1 subcode, and the set of points in $\mathbf{P}^{k-2}$ defined by the columns of $\mathbf{G}_{\mathcal{H}}$ is the image of $\{\mathbf{p}_1, \dots, \mathbf{p}_n\}$ under the projection from $\mathbf{p}_{\mathcal{H}}$.

(As already observed, $\mathcal{C}_{\mathcal{H}}$ need not be projective, so these image points need not be distinct.)

Let $f \ge g \ge d \ge 2$ be integers, and let $\Phi \in S_1^{g \times f}$ be a matrix whose entries are homogeneous linear forms, i.e. elements of $S_1$. Recall from [10, §6B] that such a matrix is said to be 1-generic if for any nonzero $\mathbf{a} \in \overline{\mathbb{F}}^g$ and $\mathbf{b} \in \overline{\mathbb{F}}^f$, $\mathbf{a}\Phi\mathbf{b}^\top$ is nonzero. Let $V_\Phi \subseteq S_1^g$ be the column span of $\Phi$, so $\dim(V_\Phi) \le f$, and set

$$
V_{\Phi, \mathcal{H}} = V_{\Phi} \cap \mathcal{H}^g. \qquad (59)
$$

Set $f_{\mathcal{H}} = \dim(V_{\Phi, \mathcal{H}}) \ge \dim(V_{\Phi}) - g$, and then let $\Phi_{\mathcal{H}} \in \mathcal{H}^{g \times f_{\mathcal{H}}}$ be a matrix whose columns form a basis of $V_{\Phi, \mathcal{H}}$.

**Proposition 4.** *Under these hypotheses:*

1. If $I_d(\mathcal{C})$ contains the $d \times d$ minors of $\Phi$, then $I_d(\mathcal{C}_{\mathcal{H}})$ contains the $d \times d$ minors of $\Phi_{\mathcal{H}}$.
2. If $\mathbf{\Phi}$ is 1-generic, then $\mathbf{\Phi}_H$ is 1-generic, and $f_H \ge f - g$.

3. If $I_d(C)$ contains the $d \times d$ minors of $\mathbf{\Phi}$, if $\mathbf{\Phi}$ is 1-generic, and if $C_H$ is a 1-shortened subcode of $C$, then $f_H \ge f - d + 1$.

*Proof.* By (57) we have $I_d(C_H) = I_d(C) \cap S_H$. Columns of $\mathbf{\Phi}_H$ belong to the column span of $\mathbf{\Phi}$, so $d \times d$ minors of $\mathbf{\Phi}_H$ are linear combinations of $d \times d$ minors of $\mathbf{\Phi}$. On the other hand, $\mathbf{\Phi}_H$ has coefficients in $H$, so its $d \times d$ minors belong to $S_H$. This proves 1.

Assume $\mathbf{\Phi}$ is 1-generic. As columns of $\mathbf{\Phi}_H$ are linearly independent and belong to the column space of $\mathbf{\Phi}$, we can write $\mathbf{\Phi}_H = \mathbf{\Phi}M$ where $M \in \mathbb{F}^{f \times f_H}$ has rk($M$) = $f_H$. Then for $\mathbf{a} \in \overline{\mathbb{F}}^g$ and $\mathbf{b} \in \overline{\mathbb{F}}^{f_H}$ nonzero we have $\mathbf{a}\mathbf{\Phi}_H\mathbf{b}^\top = \mathbf{a}\mathbf{\Phi}M\mathbf{b}^\top \neq 0$ because $M\mathbf{b}^\top$ is nonzero. This proves that $\mathbf{\Phi}_H$ is 1-generic. Then it is easily seen that a 1-generic matrix has linearly independent columns, so $\dim(V_{\mathbf{\Phi}}) = f$, hence $f_H \ge f - g$. This finishes the proof of 2.

Now we prove 3. Assume $C_H$ is the 1-shortened subcode of $C$ at position $i$, hence $\mathbf{p}_i = \mathbf{p}_H = (0 : \cdots : 0 : 1)^\top$. As $\mathbf{\Phi}$ is 1-generic, we have $\dim(V_{\mathbf{\Phi}}) = f$. Let $\mathrm{ev}_{\mathbf{p}_H}: S \to \mathbb{F}$ denote evaluation at $\mathbf{p}_H$. Applied coordinatewise, we also have evaluation maps $\mathrm{ev}_{\mathbf{p}_H}: S^g \to \mathbb{F}^g$ and $\mathrm{ev}_{\mathbf{p}_H}: S^{g \times f} \to \mathbb{F}^{g \times f}$. Also we can restrict $\mathrm{ev}_{\mathbf{p}_H}$ to subspaces, so for instance $H = \ker(\mathrm{ev}_{\mathbf{p}_H}: S_1 \to \mathbb{F})$. It then follows

$$V_{\mathbf{\Phi},H} = V_{\mathbf{\Phi}} \cap \mathcal{H}^g = \ker(\mathrm{ev}_{\mathbf{p}_H}: V_{\mathbf{\Phi}} \to \mathbb{F}^g), \quad (60)$$

while the image $\mathrm{ev}_{\mathbf{p}_H}(V_{\mathbf{\Phi}}) \subseteq \mathbb{F}^g$ is the column span of $\mathrm{ev}_{\mathbf{p}_H}(\mathbf{\Phi}) \in \mathbb{F}^{g \times f}$. As the $d \times d$ minors of $\mathbf{\Phi}$ belong to $I_d(C)$, they vanish at each column of $G$, in particular they vanish at $\mathbf{p}_H = \mathbf{p}_i$. But this means precisely that the $d \times d$ minors of $\mathrm{ev}_{\mathbf{p}_H}(\mathbf{\Phi})$ all vanish, or equivalently,

$$\dim(\mathrm{ev}_{\mathbf{p}_H}(V_{\mathbf{\Phi}})) \le d - 1. \quad (61)$$

Joint with (60) this gives $f_H = \dim(V_{\mathbf{\Phi},H}) \ge \dim(V_{\mathbf{\Phi}}) - (d - 1) = f - d + 1$.

## Application to alternant and Goppa codes

Consider a code $C \in \mathrm{Alt}^\perp_{q,m,n,t}$, assumed to be proper. By (21), after extension of scalars, $C_{\mathbb{F}_{q^m}}$ admits as a basis the $k = mt$ vectors $(\mathbf{y}\mathbf{x}^a)^{q^u}$ for $0 \le a \le t - 1$ and $0 \le u \le m - 1$. Rename the $k = mt$ variables in our polynomial ring $S$ accordingly, so that our evaluation map now is

$$S = \mathbb{F}_{q^m}[X_a^{(u)}] \to \mathbb{C}_{\mathbb{F}_{q^m}}^{\langle\cdot\rangle} \quad (62)$$

where $X_a^{(u)}$ evaluates as $(\mathbf{y}\mathbf{x}^a)^{q^u}$.

If $M$ is a matrix (or more generally an expression) in the $X_a^{(u)}$, we denote by $M^{(v)}$ the same matrix (or expression) with each $X_a^{(u)}$ replaced by $X_a^{(u+v)}$, where $u + v$ is considered mod $m$. We also write $M' = M^{(1)}$, $M'' = M^{(2)}$, etc.

Set

$$e = \lfloor \log_q(t - 1) \rfloor, \quad (63)$$
and for any $0 \le u \le e$ define a $2 \times (t - q^u)$ matrix

$$ \mathbf{B}_u = \begin{pmatrix} X_0^{(0)} & X_1^{(0)} & \dots & X_{t-1-q^u}^{(0)} \\ X_{q^u}^{(0)} & X_{q^u+1}^{(0)} & \dots & X_{t-1}^{(0)} \end{pmatrix}. \qquad (64) $$

We then define the block matrix

$$ \mathbf{\Phi} = (\mathbf{B}_0^{(e)} | \mathbf{B}_1^{(e-1)} | \dots | \mathbf{B}_e^{(0)}) \qquad (65) $$

of total size $2 \times f$ where $f = (e+1)t - \frac{q^{e+1}-1}{q-1}$. Observe that this matrix only depends on $q$ and $t$, debatably on $m$, but certainly not on $n$ nor on the specific choice of $C$.

**Lemma 7.** The $2 \times 2$ minors of $\mathbf{\Phi}$ belong to $I_2(\mathbb{C}_{\mathbb{F}_{q^m}})$.

*Proof.* The $2 \times 2$ minor defined by the columns $\begin{bmatrix} X_a^{(e-u)} \\ X_{q^u+a}^{(e-u)} \end{bmatrix}$ of $\mathbf{B}_u^{(e-u)}$ and $\begin{bmatrix} X_b^{(e-v)} \\ X_{q^v+b}^{(e-v)} \end{bmatrix}$ of $\mathbf{B}_v^{(e-v)}$ is

$$ X_a^{(e-u)} X_{q^v+b}^{(e-v)} - X_{q^u+a}^{(e-u)} X_b^{(e-v)} \qquad (66) $$

which evaluates under (62) to

$$ (\mathbf{y}\mathbf{x}^a)^{q^{e-u}} (\mathbf{y}\mathbf{x}^{q^v+b})^{q^{e-v}} - (\mathbf{y}\mathbf{x}^{q^u+a})^{q^{e-u}} (\mathbf{y}\mathbf{x}^b)^{q^{e-v}} = \mathbf{0}. \qquad (67) $$

**Lemma 8.** The matrix $\mathbf{\Phi}$ is 1-generic.

*Proof.* Let $\mathbf{a} \in \overline{\mathbb{F}}_q^2$ and $\mathbf{b} \in \overline{\mathbb{F}}_q^f$ be nonzero. Let $a_i$ be the rightmost nonzero entry of $\mathbf{a}$ and $b_j$ the rightmost nonzero entry of $\mathbf{b}$. Then the $X_c^{(u)}$ variable that multiplies $a_ib_j$ in $\mathbf{a}\mathbf{\Phi}\mathbf{b}^\top$ does not appear elsewhere in $\mathbf{a}\mathbf{\Phi}\mathbf{b}^\top$, so $\mathbf{a}\mathbf{\Phi}\mathbf{b}^\top \neq 0$.

**Theorem 1.** Let $C \in \mathrm{Alt}_{q,m,n,t}^\perp$ be proper, $e = \lfloor \log_q(t-1) \rfloor$, $f = (e+1)t - \frac{q^{e+1}-1}{q-1}$. For any $s \ge 0$, let $C_s$ be a s-shortened subcode of $C$. Then for all $r \ge 2$ we have $\beta_{r-1,r}(C_s) \ge (r-1)\binom{f_s}{r}$, hence

$$ r_{\max}(C_s) \ge f - s. \qquad (68) $$

*Proof.* By Lemma 6 we can extend scalars to $\mathbb{F}_{q^m}$. By Lemma 7, $I_2(C)$ then contains the $2 \times 2$ minors of the $2 \times f$ matrix $\mathbf{\Phi}$, and this matrix $\mathbf{\Phi}$ is 1-generic by Lemma 8. By Proposition 4 applied $s$ times (with $g = d = 2$), $I_2(C_s)$ then contains the $2 \times 2$ minors of a $2 \times f_s$ matrix $\mathbf{\Phi}_s$, where $f_s \ge f-s$, and this matrix $\mathbf{\Phi}_s$ is 1-generic also. Then by [10, §6B], the $2 \times 2$ minors of $\mathbf{\Phi}_s$ are linearly independent, and its Eagon-Northcott complex is exact with only nonzero Betti numbers $\beta_{0,0} = 1$ and $\beta_{r-1,r} = (r-1)\binom{f_s}{r}$ for $2 \le r \le f_s$. We then conclude with Corollary 2 (with $l=1$ and $V^{(1)} = \mathrm{im}(\Lambda^2 \mathbf{\Phi}_s)$).

*Remark 1.* It is possible to improve the lower bound on $\beta_{r-1,r}(C_s)$, using not only $\mathbf{\Phi} = \mathbf{\Phi}^{(0)}$, but also its conjugates $\mathbf{\Phi}^{(1)}, \dots, \mathbf{\Phi}^{(m-1)}$. See the corresponding discussion at the beginning of the Supplementary material.
Examples show the bound (68) on $r_{max}$ is tight in general for alternant codes. However one can improve it in the Goppa case. Let us focus on $q = 2$ for simplicity. Let $\varphi: a \mapsto a^2$ be the Frobenius map, acting on any $\mathbb{F}_2$-algebra. For any polynomial $g \in \mathbb{F}_{2^m}[X]$, set $L_g = g(X)^{-1}\mathbb{F}_{2^m}[X]_{<\deg(g)} \subseteq \mathbb{F}_{2^m}(X)$.

**Lemma 9.** Let $g(X) \in \mathbb{F}_{2^m}[X]$ be squarefree (i.e. separable). Then

$$L_g + \varphi(L_g) = L_{g^2}, \qquad (69)$$

the sum being direct

*Proof.* Set $t = \deg(g)$. Then $L_g$ and $\varphi(L_g)$ both are $t$-dimensional subspaces of the $2t$-dimensional space $L_{g^2}$. To conclude we only have to prove $L_g \cap \varphi(L_g) = 0$. However we have $F(X) \in L_g \cap \varphi(L_g)$ if and only if $F(X) = \frac{A(X)}{g(X)} = \frac{B(X)^2}{g(X)^2}$ for some $A, B$ of degree $< t$. But then this implies $g(X)|B(X)^2$ with $g$ squarefree of degree $t$, which is impossible unless $B = 0$.

From this we readily deduce:

**Lemma 10.** Let $\mathbf{x} \in (\mathbb{F}_{2^m})^n$ be a support, and $g(X) \in \mathbb{F}_{2^m}[X]$ squarefree of degree $t \le n/2$, not vanishing on any entry of $\mathbf{x}$. Then

$$\mathrm{GRS}_t(\mathbf{x}, g(\mathbf{x})^{-1}) + \mathrm{GRS}_t(\mathbf{x}^2, g(\mathbf{x})^{-2}) = \mathrm{GRS}_{2t}(\mathbf{x}, g(\mathbf{x})^{-2}), \qquad (70)$$

the sum being direct.

**Proposition 5.** Let $C = \mathrm{Gop}(\mathbf{x}, g)^\perp \in \mathrm{Gop}_{2,m,n,t}^{\mathrm{sqfr},\perp}$ be proper, with $g$ squarefree. Set $\mathbf{y} = g(\mathbf{x})^{-1}$. Then

$$C_{\mathbb{F}_{q^m}} = \bigoplus_{i=0}^{m/2-1} \mathrm{GRS}_{2t}(\mathbf{x}^{4^i}, \mathbf{y}^{4^i}), \quad \text{or} \qquad (71)$$

$$C_{\mathbb{F}_{q^m}} = \left( \bigoplus_{i=0}^{(m-1)/2-1} \mathrm{GRS}_{2t}(\mathbf{x}^{4^i}, \mathbf{y}^{4^i}) \right) \oplus \mathrm{GRS}_t(\mathbf{x}^{2^{m-1}}, \mathbf{y}^{2^{m-1}}) \qquad (72)$$

depending on whether $m$ is even or odd.

**Corollary 4.** Let $C = \mathrm{Gop}(\mathbf{x}, g)^\perp \in \mathrm{Gop}_{2,m,n,t}^{\mathrm{sqfr},\perp}$ be proper, with $g$ squarefree. Set $\hat{e} = [\log_4(2t-1)]$ and $\hat{f} = (2\hat{e}+2)t - \frac{4^{\hat{e}+1}-1}{3}$. For any $s \ge 0$, let $C_s$ be a $s$-shortened subcode of $C$. Then for all $r \ge 2$ we have $\beta_{r-1,r}(C_s) \ge (r-1)(\hat{f}_r^{-s})$, hence

$$r_{\max}(C_s) \ge \hat{f} - s. \qquad (73)$$

*Proof.* Same as Theorem 1, with $\Phi$ adapted to fit Proposition 5.
# 4 Regularity 2 and the small defect heuristic

## Regularity 2 and consequences

If $\mathcal{C}$ is a $[n, k]$-code, we let

$$B_j = \sum_{i \ge 0} (-1)^i \beta_{i,j} \qquad (74)$$

be the alternating sum of its Betti numbers degree $j$, and $B(z) = \sum_{j \ge 0} B_j z^j$ their generating polynomial (it is indeed a finite sum).

Let also $H_{\mathcal{C}}(z) = \sum_{r \ge 0} z^r \dim \mathcal{C}^{\langle r \rangle}$ be the Hilbert series of $\mathcal{C}$.

**Proposition 6.** *We have*

$$B(z) = (1 - z)^k H_{\mathcal{C}}(z). \qquad (75)$$

*Proof.* Generating series reformulation of [10, Cor. 1.10].

**Definition 5 ([26, Def. 1.5 & Th. 2.35]).** The Castelnuovo-Mumford regularity of a projective $[n, k]$-code $\mathcal{C}$ is the smallest integer $r$ such that $\mathcal{C}^{\langle r \rangle} = \mathbb{F}^n$.

**Definition 6 (cf. [10, §4A], after [23, Lect. 14]).** The Castelnuovo-Mumford regularity of $\mathcal{C}^{\langle r \rangle}$ is $\max\{r : \exists i, \beta_{i,i+r}(\mathcal{C}) > 0\}$.

**Proposition 7 ([10, Th. 4.2]).** These two definitions coincide.

From now on we will just say “regularity” for short.

The square code distinguisher, and the filtration attack from [1] that extends it, work for codes $\mathcal{C}$ with $\mathcal{C}^{(2)} \subsetneq \mathbb{F}^n$, i.e. of regularity $> 2$. This means that codes of regularity 2 are hard to deal with under this approach. On the opposite, for us, codes of regularity 2 are nice because Definition 6 means their Betti diagram is simple: it has only two nontrivial rows. Observe that most codes of interest have regularity 2 (with the notable exception of self-dual codes).

**Definition 7.** If $f: U \to V$ is a linear map between finite dimensional $\mathbb{F}$-vector spaces, we define its index

$$ \begin{aligned} \mathrm{ind}(f) &= \dim(U) - \dim(V) \\ &= \dim \ker(f) - \dim \mathrm{coker}(f) \end{aligned} \qquad (76) $$

and its rank defect

$$ \begin{aligned} \mathrm{def}(f) &= \min(\dim(U), \dim(V)) - \mathrm{rk}(f) \\ &= \min(\dim \ker(f), \dim \mathrm{coker}(f)). \end{aligned} \qquad (77) $$

For any real $x$ we set $x^+ = \max(x, 0)$ and $x^- = (-x)^+$, so $x = x^+ - x^-$. Then we always have

$$ \dim \ker(f) \ge \mathrm{ind}(f)^+ \qquad (78) $$

$$ \dim \mathrm{coker}(f) \ge \mathrm{ind}(f)^- \qquad (79) $$
and then

$$ \mathrm{def}(f) = \dim \ker(f) - \mathrm{ind}(f)^+ = \dim \mathrm{coker}(f) - \mathrm{ind}(f)^- \quad (80) $$

measures the distance to equality in these two inequalities.

For $r \ge 3$, recall the linear map $\varphi_r : M_{r-2,r-1} \otimes S_1 \to M_{r-2,r}$ from (27). It will also be handy to let $\varphi_2 = \mathrm{ev}_{G,2} : S_2 \to C^{(2)}$ be the evaluation map.

**Theorem 2.** For all $r \ge 2$ we have

$$ \dim \ker(\varphi_r) = \beta_{r-1,r} \quad (81) $$

$$ \dim \mathrm{coker}(\varphi_r) = \beta_{r-2,r} \quad (82) $$

and moreover, if $C^{(2)} = \mathbb{F}^n$, then

$$ \mathrm{ind}(\varphi_r) = \left( \frac{k(k+1)}{r} - n \right) \binom{k-1}{r-2} \quad (83) $$

*Proof.* For $r = 2$ this is proved directly. Now assume $r \ge 3$. Then the first two equalities are reformulations of Lemma 4. Now assume moreover $C^{(2)} = \mathbb{F}^n$. Then $H_C(z) = 1 + kz + n \frac{z^2}{1-z}$, so $B(z) = (1+kz)(1-z)^k + nz^2(1-z)^{k-1}$ by Proposition 6, thus $B_r = (-1)^{r-1}(r-1) \binom{k+1}{r} + (-1)^r n \binom{k-1}{r-2} = (-1)^{r-1} \left( \frac{k(k+1)}{r} - n \right) \binom{k-1}{r-2}$. On the other hand, $C^{(2)} = \mathbb{F}^n$ also means $C$ has regularity 2 in the sense of Definition 6, so (74) reduces to $B_r = (-1)^{r-1}\beta_{r-1,r} + (-1)^{r-2}\beta_{r-2,r} = (-1)^{r-1}\mathrm{ind}(\varphi_r)$ and we conclude.

**Corollary 5.** If $C^{(2)} = \mathbb{F}^n$, then the bottom right entry of its Betti diagram is

$$ \beta_{k-1,k+1} = n-k. \quad (84) $$

*Proof.* The minimal resolution of $C$ has length $k-1$, so $\beta_{i,j} = 0$ for $i > k-1$, hence $\beta_{k-1,k+1} = -\mathrm{ind}(\varphi_{k+1}) = n-k$.

Regularity 2 helps in computing the full Betti diagram of codes. See Propositions 10 and 11 in the Supplementary material for more.

## The small defect heuristic

By (78) and Theorem 2, for any $[n,k]$-code $C$ of regularity 2 and for any $r \ge 2$ we have

$$ \beta_{r-1,r}(C) \ge \left( \frac{k(k+1)}{r} - n \right)^+ \binom{k-1}{r-2}. \quad (85) $$

We might interpret this lower bound as the number of “contingent” syzygies that are forced to exist, solely because of the dimension difference between the source and target spaces of the map $\varphi_r$. Then, when $C$ is random, it is quite natural to expect that no other syzygy will appear, or equivalently that (85) will be an equality, i.e. $\mathrm{def}(\varphi_r) = 0$.
This is compatible with results such as those in [6] and the references within, that give estimates on the distribution of the rank, hence the defect, of random linear maps, under various probability laws. Unfortunately, even if the probability distribution of $\mathbb{C}$ is nice (say, uniform among codes of given $[n, k]$), it is not easy to control the distribution of $\varphi_r$, so we will not be able to give proofs. Moreover it could be that the iterative algebraic process in the construction of $\varphi_r$ would lead to some unexpected constraints on its rank. And indeed, in this section we will identify some parameter ranges for which the defect *cannot* be small; but conversely, we will also give arguments that support the validity of this small defect heuristic *at least under some proper conditions*.

A first argument in support of the heuristic is that it is unconditionally true when $r=2$. Indeed, in this special case, [3] manages to give lower bounds, exponentially close to 1, on the probability that $\mathrm{def}(\varphi_2) = 0$.

Another argument is the minimal resolution conjecture of [19]. It postulates that, over an infinite field, a Zariski-generic code satisfies $\beta_{r-1,r}(\mathbb{C}) = 0$ for $r \ge \frac{k(k+1)}{n}$ and $\beta_{r-2,r}(\mathbb{C}) = 0$ for $r \le \frac{k(k+1)}{n}$ or equivalently, $\mathrm{def}(\varphi_r) = 0$ for all $r \ge 2$. However, two points require our attention:

1. This conjecture is now known to be false in general [11].

2. We work over a finite field, not an infinite one.

Concerning point 1, we will argue that the conjecture is still “true enough” for our use. First, a nonzero defect might not be a problem in our Betti number estimates, as long as it remains small. Moreover, as noted in the introduction of [11], the conjecture has been proved for a large range of values of $n$ and $k$. In fact, although [11] provides an infinity of counterexamples, these remain limited to very specific parameters, namely of the form $n = k + O(\sqrt{k})$. And indeed, perhaps the most valuable result for us is [17], which proves that the conjecture is true when $n$ is large enough with respect to $k$.

Concerning point 2, clearly, codes behave quite differently over a finite field and over an infinite field. For instance, generic codes over an infinite field are MDS for any parameter set, while over a finite field they clearly are not. This makes it desirable to investigate links between Betti numbers and distance properties of a code.

For any code $\mathbb{C}$, let us denote by $A_i(\mathbb{C})$ the number of codewords of Hamming weight $i$ in $\mathbb{C}$.

**Experimental fact 1.** Let $\mathbb{C}$ be a $[n, k]_q$-code of regularity 2, with minimum distance $d = d_{\min}(\mathbb{C})$ and dual minimum distance $d^{\perp} = d_{\min}(\mathbb{C}^{\perp})$.

1. For all $r \ge d^{\perp}$ we have $\beta_{r-2,r}(\mathbb{C}) > 0$.

Moreover if $d^{\perp} \le \frac{k(k+1)}{n}$ we have $\beta_{d^{\perp}-2,d^{\perp}}(\mathbb{C}) \ge A_{d^{\perp}}(\mathbb{C}^{\perp})/(q-1)$ (and there are numerous examples of $\mathbb{C}$ where this inequality is an equality).

2. Dually, for all $r \le k+1-d$ we have $\beta_{r-1,r}(\mathbb{C}) > 0$.

Moreover if $k+1-d \ge \frac{k(k+1)}{n}$ we have $\beta_{k-d,k+1-d}(\mathbb{C}) \ge A_d(\mathbb{C})/(q-1)$ (and there are numerous examples of $\mathbb{C}$ where this inequality is an equality).
It follows that $\mathrm{def}(\varphi_r) > 0$ for $d^\perp \le r \le \frac{k(k+1)}{n}$ and for $\frac{k(k+1)}{n} \le r \le k+1-d$, when applicable (i.e. when these intervals are nonempty).

**Experimental fact 2.** Conversely, for a random code $C$ among codes of given parameters $[n, k, d, d^\perp]_q$, the probability that $\mathrm{def}(\varphi_r) = 0$ tends quickly to 1 as $r \ll \min(d^\perp, \frac{k(k+1)}{n})$ and as $r \gg \max(\frac{k(k+1)}{n}, k+1-d)$.

In particular $r_{\max}(C) = \max(\lfloor \frac{k(k+1)}{n} \rfloor, k+1-d)$, or is very close to this value, with high probability.

Figures 11-14 in the Supplementary material illustrate various aspects of these Experimental facts.

Consequently, we postulate:

**Heuristic 1.** Fix a field cardinality $q$, assume $n$ is not too close to $k$ in order to stay away from the counterexamples to the minimal resolution conjecture, and $n < \binom{k+1}{2}$ in order to ensure regularity 2. Then for random $[n, k]_q$-codes, with high probability:

1. if $d > k+1 - \frac{k(k+1)}{n}$ we expect $\beta_{r-1,r} = 0$ for $r > \frac{k(k+1)}{n}$

2. if $d^\perp > \frac{k(k+1)}{n}$ we expect $\beta_{r-1,r} = (\frac{k(k+1)}{r} - n) \binom{k-1}{r-2}$ for $r < \frac{k(k+1)}{n}$.

*Remark 2.* Consider this Heuristic in the asymptotic regime. Setting $R = k/n$, we can take $d = d_{GV}(q, n, k) \approx H_q^{-1}(1-R)n$ and $d^\perp = d_{GV}(q, n, n-k) \approx H_q^{-1}(R)n$ the corresponding Gilbert-Varshamov distances, where $H_q$ is the $q$-ary entropy function. Then the condition in 1. translates as $H_q^{-1}(1-R) > R(1-R)$, and the condition in 2. translates as $H_q^{-1}(R) > R^2$, both of which are satisfied when $R$ is small enough. In particular for $q=2$, we find that 1. is satisfied for $R < 0.277$ and 2. is satisfied for $R < 0.141$.

# 5 The distinguisher

## Basic version (without shortening)

Distinguishers typically work by computing certain code invariants. We might have theoretical bounds on the values of these invariants, that are essential for an asymptotic analysis. However these bounds need not be tight. Hence for a given set of finite parameters, we can also adopt a more empirical approach: sample a certain number of codes, compute their invariants, and observe when the distinguisher “just works”.

So for given $q, m, t$ and a type of codes (alternant or Goppa), we set $n = q^m$ and we compute the Betti numbers of a certain number of dual codes. Most of the time, it turns out that these numbers are the same for all samples. We will denote by $\beta_{r-1,r}^*$ these common values. By Corollary 3, these $\beta_{r-1,r}^*$ still provide lower bounds on $\beta_{r-1,r}$ for smaller $n$.
For a given $r$ with $\beta_{r-1,r}^* > 0$, our distinguisher then works as follows. Taking as input a (dual) code $\mathcal{C}$ of dimension $k = mt$, compute $\beta_{r-1,r}(\mathcal{C})$ with Algorithm 1. Then if $\beta_{r-1,r}(\mathcal{C}) \ge \beta_{r-1,r}^*$ declare $\mathcal{C}$ is of the special type in question. Otherwise declare $\mathcal{C}$ is random.

Observe that for random codes of dimension $k$, if the conditions in Heuristic 1 are satisfied, we expect $\beta_{r-1,r} = \left(\frac{k(k+1)}{r} - n\right)^+ \binom{k-1}{r-2}$. Thus the distinguisher succeeds when this value is smaller than $\beta_{r-1,r}^*$, or equivalently when

$$n \ge \left[ \frac{k(k+1)}{r} - \frac{\beta_{r-1,r}^* - 1}{\binom{k-1}{r-2}} \right]. \qquad (86)$$

When $r = 2$, this gives the distinguishability threshold of the square code distinguisher of [12]. Using syzygies of higher degree $r$ allows to make the term $\frac{k(k+1)}{r}$ smaller and reach a broader range of parameters.

We compared our new distinguisher (in this basic version) with the one from [7], on the very same examples taken from this reference: $Gop_{4,4,4}^{\text{irr}}$ and $Gop_{2,6,3}^{\text{irr}}$. Results can be found at the end of the Supplementary material. In both cases, we improve the distinguishability threshold. Interestingly, for $Gop_{4,4,4}^{\text{irr}}$, this improved threshold is the one given by (86) (with $r = r_{\text{max}}^* = 4$), i.e. the conditions in Heuristic 1 are always met. On the other hand, for $Gop_{2,6,3}^{\text{irr}}$, the conditions in Heuristic 1 are the limiting factor (but still improving over [7]).

A general description of the set of distinguishable parameters is complicated, as it has to encompass both (86) and the conditions in the heuristic. However, a very interesting phenomenon will appear in the asymptotic analysis: all these constraints will be automatically satisfied, i.e. asymptotically all parameters will become distinguishable.

## Full version (with shortening)

We can also use shortened dual codes as input in our distinguisher. In general, shortening $s$ times a $[n, k]$-code $\mathcal{C}$ produces a $[n_s, k_s]$-code $\mathcal{C}_s$ with $n_s = n - s$, $k_s = k - s$. Having smaller parameters will decrease the complexity. Moreover the (dual) rate $R_s = k_s/n_s$ also decreases when we shorten; as observed in Remark 2, this will help satisfying the conditions in Heuristic 1.

**Example 1.** Consider the class $Gop_{2,10,10}^{\text{irr},\perp}$ of dual binary Goppa codes with $m = 10$, $n = 1024$, $t = 10$, irreducible Goppa polynomial. Without shortening, these codes are out of reach of our distinguisher: we would have to run Algorithm 1 up to $r = 10$ and do linear algebra in dimension roughly $10^{20}$, which is infeasible. On the other hand, we can effectively distinguish after shortening 40 times: we experimentally find that 40-shortened $Gop_{2,10,10}^{\text{irr},\perp}$ have $\beta_{3,4} = 30$, while $\beta_{3,4} = 0$ for random codes with the same parameters. Computational cost (several days each, on a workstation with several hundreds of GB of RAM) prevented the author to run more than a few tests, but no deviation was observed. In particular $\beta_{3,4} = 0$ consistently in the random case confirms Heuristic 1 for these parameters.
**Proposition 8.** Fix a class $\mathcal{T}_{q,m,n,t}$ of dual alternant or Goppa codes with some given parameters $q, m, n, t$, and assume that for some integer $r^*$ we have a lower bound of the form

$$r_{\max}(C_s) \geq r^* - s \qquad (87)$$

for all $C \in \mathcal{T}_{q,m,n,t}$ and all s-shortened subcodes $C_s$ of $C$.

Set $k = mt$, and let $C$ be either a random $[n, k]_q$-code, or an element of $\mathcal{T}_{q,m,n,t}$.

Choose an integer $s$ such that

$$\frac{k_s(k_s+1)}{n_s} < r^* - s \qquad (88)$$

where $n_s = n - s$ and $k_s = k - s$.

1. Let $d_s \approx d_{GV}(q, n_s, k_s)$ be the typical minimum distance of random $[n_s, k_s]_q$-codes, and assume $d_s > k_s + 1 - \frac{k_s(k_s+1)}{n_s}$. Then, under part 1. of Heuristic 1, computing

$$\beta_{r^*-s-1,r^*-s}(C_s), \qquad (89)$$

where $C_s$ is any s-shortened subcode of $C$, allows to distinguish whether $C$ is a random code (in which case $\beta_{r^*-s-1,r^*-s}(C_s) = 0$ w.h.p.) or an element of $\mathcal{T}_{q,m,n,t}$ (in which case $\beta_{r^*-s-1,r^*-s}(C_s) > 0$).

2. Moreover, let $d_s^\perp \approx d_{GV}(q, n_s, n_s - k_s)$ be the typical dual distance of random $[n_s, k_s]_q$-codes, and assume $d_s^\perp > \frac{k_s(k_s+1)}{n_s}$. Then, under Heuristic 1, for large enough parameters the complexity of this distinguisher is dominated by the sum

$$\kappa = \sum_{i \le \lfloor \frac{k_s(k_s+1)}{n_s} \rfloor + 1} \max \left( k_s \operatorname{ind}(\varphi_{i-1}), \binom{k_s+1}{2} \operatorname{ind}(\varphi_{i-2}) \right)^{\omega} \qquad (90)$$

where $\operatorname{ind}(\varphi_i) = \binom{k_s(k_s+1)}{i} - n_s \binom{k_s-1}{i-2}$ and $\omega \approx 2.372$ is the exponent of linear algebra.

*Proof.* If $C$ is random, so is $C_s$. Then, as $d_s > k_s + 1 - \frac{k_s(k_s+1)}{n_s}$, under part 1. of Heuristic 1 we indeed expect $\beta_{r^*-s-1,r^*-s}(C_s) = 0$ for $r^* - s > \frac{k_s(k_s+1)}{n_s}$. On the other hand, for $C$ in $\mathcal{T}_{q,m,n,t}$, the lower bound $r_{\max}(C_s) \ge r^* - s$ precisely means $\beta_{r^*-s-1,r^*-s}(C_s) > 0$.

Now using Algorithm 1 we obtain $\beta_{r^*-s-1,r^*-s}(C_s)$ after computing the left kernel of the matrices $M_i$ for $2 \le i \le r^* - s$. The contributions for $i < 4$ are negligible. For $i \ge 4$, the matrix $M_i$ has size $k_s\beta_{i-2,i-1}(C_s) \times \binom{k_s+1}{2}\beta_{i-3,i-2}(C_s)$ and the contributions for $i > \lfloor \frac{k_s(k_s+1)}{n_s} \rfloor + 1$ are negligible because of part 1. Then, as $d_s^\perp > \frac{k_s(k_s+1)}{n_s}$, under part 2. of Heuristic 1 we expect $\beta_{i-1,i}(C_s) = \operatorname{ind}(\varphi_i)$ for $2 \le i \le \frac{k_s(k_s+1)}{n_s}$ for random $C$; and we can assume this holds also for $C \in \mathcal{T}_{q,m,n,t}$, otherwise computing this dimension readily provides a distinguisher with lower complexity. From this we conclude.
*Example 2.* The following table shows how the distinguisher from Proposition 8 applies to Classic McEliece parameters. We take $r^* = \hat{f}$ as given by Corollary 4, and then choose the maximum possible shortening order $s$ satisfying (88).

<table><thead><tr><th>(n, m, t)</th><th>(3488, 12, 64)</th><th>(4608, 13, 96)</th><th>(6688, 13, 128)</th><th>(6960, 13, 119)</th><th>(8192, 13, 128)</th></tr></thead><tbody><tr><td>r<sup>*</sup></td><td>427</td><td>683</td><td>939</td><td>867</td><td>939</td></tr><tr><td>s</td><td>377</td><td>568</td><td>816</td><td>769</td><td>848</td></tr><tr><td>r<sup>*</sup> - s</td><td>50</td><td>115</td><td>123</td><td>98</td><td>91</td></tr><tr><td>[n<sub>s</sub>, k<sub>s</sub>]</td><td>[3111, 391]</td><td>[4040, 680]</td><td>[5872, 848]</td><td>[6191, 778]</td><td>[7344, 816]</td></tr><tr><td><sup>k<sub>s</sub>(k<sub>s</sub>+1)</sup>/<sub>n<sub>s</sub></sub></td><td>49.27</td><td>114.62</td><td>122.61</td><td>97.89</td><td>90.78</td></tr><tr><td>d<sub>GV</sub></td><td>921</td><td>1069</td><td>1650</td><td>1828</td><td>2256</td></tr><tr><td>d<sub>GV</sub><sup>⊥</sup></td><td>55</td><td>62</td><td>122</td><td>108</td><td>110</td></tr><tr><td>κ</td><td>2<sup>528</sup></td><td>(2<sup>1080</sup>)</td><td>(2<sup>1224</sup>)</td><td>2<sup>1030</sup></td><td>2<sup>997</sup></td></tr></tbody></table>

We observe that the condition $d_{GV}(n_s, k_s) > k_s + 1 - \frac{k_s(k_s+1)}{n_s}$ is always satisfied with a large margin, so we could choose a smaller $s$ and still be able to distinguish. Concerning the complexity estimate $\kappa$, it relies on the condition $d_{GV}(n_s, n_s - k_s) > \frac{k_s(k_s+1)}{n_s}$. We see this condition is satisfied for the parameter sets (3488, 12, 64), (6960, 13, 119), (8192, 13, 128), but for (4608, 13, 96) and (6688, 13, 128) it is not (then, it would still be possible to give a complexity estimate, using Lemma 5 instead of Heuristic 1). These complexities improve those from [7], although they remain practically unreachable and well beyond security levels.

## Asymptotics

Fix a base field cardinality $q$, for instance $q = 2$, and a (dual) rate $R$. In [4] it is suggested to take a primal code of rate between 0.7 and 0.8, so passing to the dual gives $0.2 \le R \le 0.3$. However here we allow any $R$. Then for $n \to \infty$ set:

$$ -m = \lceil \log_q(n) \rceil = \log_q(n) + O(1) $$

$$ -k \approx Rn \text{ such that:} $$

$$ -t = \frac{k}{m} \text{ is an integer.} $$

A key observation then is that the lower bound $f$ on $r_{max}$ of dual alternant codes in Theorem 1, or equivalently, the number $f$ of columns of the matrix $\Phi$ in (65), is very close to $k$:

**Lemma 11.** We have

$$ f = \left( 1 - \frac{\log_q \log_q(n)}{\log_q(n)} + O\left( \frac{1}{\log_q(n)} \right) \right) k. \qquad (91) $$

*Proof.* Direct consequence of:

$$ -e = \lceil \log_q(t-1) \rceil = \log_q(n) - \log_q \log_q(n) + O(1) $$

$$ -f = (e+1)t - \frac{q^{e+1}-1}{q-1} = et + O(t). $$
In the case of binary Goppa codes, the $\hat{f}$ from Corollary 4 improves the $f$ from Theorem 1. However one could show that both have the same asymptotics. So, in order to distinguish these codes from random codes, we will not care about the extra structure: treating Goppa codes as alternant codes will suffice. (Still, this could be used to distinguish Goppa from “general” alternant codes.)

Now, under Heuristic 1, we have:

**Theorem 3.** Asymptotically, q-ary alternant (including Goppa) codes of dual rate R can be distinguished from random codes, with complexity at most

$$ \kappa = q^{\left(\omega \frac{R^2}{1-R} + o(1)\right) \frac{(\log_q \log_q(n))^3}{(\log_q(n))^2}} n \quad (92) $$

where $\omega \approx 2.372$ is the exponent of linear algebra.

*Proof.* We use Proposition 8 with $\mathcal{T} = \text{Alt}^{\perp}$, and $r^* = f$ as provided by Theorem 1. The analysis will be easier if rephrased in terms of $k_{r^*} = k - r^*$ and $r = r^* - s$. First, Lemma 11 gives

$$ k_{r^*} = k - f \sim R \frac{\log_q \log_q(n)}{\log_q(n)} n. \quad (93) $$

Let us then turn to condition (88). Fix an $\varepsilon > 0$, and set

$$ r = \left[ (1 + \varepsilon) \frac{R^2}{1 - R} \left( \frac{\log_q \log_q(n)}{\log_q(n)} \right)^2 n \right] \ll k_{r^*} \quad (94) $$

and $s = r^* - r$. Then $k_s = k_{r^*} + r$ and $n_s = n - k + k_{r^*} + r$, so for $n$ large enough we get

$$ \frac{k_s(k_s+1)}{n_s} = \frac{(k_{r^*}+r)(k_{r^*}+r+1)}{n-k+k_{r^*}+r} \approx \frac{k_{r^*}^2}{n-k} \approx \frac{R^2}{1-R} \left( \frac{\log_q \log_q(n)}{\log_q(n)} \right)^2 n < r = r^* - s. \quad (95) $$

Thus, for any $\varepsilon > 0$, condition (88) is satisfied with this value of $r$ as soon as $n$ is large enough, say larger than some $n(\varepsilon)$. But this means precisely that as $n \to \infty$, we can let $\varepsilon = \varepsilon(n) \to 0$ while still satisfying the condition. We then get

$$ r \sim \frac{R^2}{1-R} \left( \frac{\log_q \log_q(n)}{\log_q(n)} \right)^2 n. \quad (96) $$

Moreover the shortened code $C_s$ has rate $\frac{k_s}{n_s} = \frac{k_{r^*}+r}{n-k+k_{r^*}+r} = o(1)$, so by Remark 2 both conditions in Heuristic 1 are satisfied. Thus Proposition 8 applies.

Now in (90) we use $\text{ind}(\varphi_i) \le k_s^2 \binom{k_s}{i-2} \le k_s^2 \binom{k_s}{r}$, so $\kappa \le r (k_s^4 \binom{k_s}{r})^\omega = r ((k_{r^*} + r)^4 \binom{k_{r^*} + r}{r})^\omega$. The asymptotics of this expression is governed by the binomial coefficient. Using $r \ll k_{r^*}$ and Stirling's formula we find $\log_q (k_{r^*} + r) \sim \log_q (k_{r^*}) \sim r \log_q (\frac{k_{r^*}}{r})$, and we conclude.
In [5, §3.4], the security level $2^b$ — or less formally, the number $b$ of targeted “bits of security” — of the Classic McEliece system, essentially defined as the complexity of the currently best attack (namely, by information set decoding), is shown asymptotically to be linear in $t \propto n/\log(n)$. Then in (92) we have

$$ \frac{\log(\kappa)}{n/\log(n)} \propto \frac{(\log \log(n))^3}{\log(n)} \to 0 $$

which means that the complexity of our distinguisher is subexponential in $b$ (although, admittedly, only very slightly so).

# 6 Conclusion and open problems

We presented the first structural analysis of the McEliece cryptosystem whose asymptotic complexity is better than that of generic decoding algorithms; more precisely, subexponential in the error-correcting capability of the code. However this is only an asymptotic result: for concrete, finite parameters, such as those proposed in the Classic McEliece specification, a naive implementation of our distinguisher still falls beyond the best attacks by a non-negligible factor.

**Problem 1.** Improve the implementation of this distinguisher.<fnref n="3" />

For instance, if we choose a monomial order in Algorithm 1, and have a reduced basis for one syzygy space, then the generalized Macaulay matrix constructed from it will be (i) somewhat sparse and (ii) already partially reduced. This could be exploited to make the computation of (a reduced basis of) the next syzygy space faster.

Alternatively, instead of iteratively computing a whole range of the linear strand, one could directly compute a targeted Betti number, e.g. using Koszul cohomology (the author would like to thank W. Castryck for this suggestion). It is then likely that this Koszul cohomology computation could also benefit from similar optimizations (i) and (ii) exploiting sparsity and structure.

**Problem 2.** Can our distinguisher, and in particular the Betti number computation, benefit from a quantum speedup?

**Problem 3.** Our lower bounds on the Betti numbers, and in particular the $r_{max}$, of dual alternant or Goppa codes, are not tight in general. Can they be improved? Better, can one give a complete, explicit description of the minimal resolution of these codes? (See at the beginning of the Supplementary material for elements in this direction.)

We initiated the study of higher syzygies of codes (or equivalently, of finite sets of points in projective space) from a genuinely coding theoretical perspective.

<footnote n="3">³ addendum: actually, the improvements discussed below can already be found in works of Kreuzer-Lusteck and Albano-La Scala</footnote>
*Problem 4*. Pursue this study in a systematic way. This should cover basic operations on codes (some of which have a nice geometric interpretation, some of which less so), and also crucially, make links with various metric properties of the code such as its weight distribution, generalized weight hierarchy, etc.

*Problem 5*. Can higher syzygies serve in decoding algorithms?

*Problem 6*. Betti numbers actually are invariants of the monomial equivalence class of a code (Lemma 3). Can they find other applications, for instance, to problems of code equivalence?

*Problem 7*. Can our distinguisher be turned into a key recovery attack, or more properly, can some of the ideas beneath be used to build a key recovery attack? For instance, one would like to combine our approach with:

- filtration arguments

- extraction of short relations, e.g. via MinRank techniques.

(Observe that some of the explicit syzygies described in Proposition 3 are short, while Proposition 4 shows that short relations pass to shortened subcodes.)

It is very common that new mathematical tools (Euclidean lattices, elliptic curves, pairings, isogenies...) are introduced in the cryptographic realm first for cryptanalytic purposes, i.e. to break systems. Once digested by the community, they are then used in a more constructive way, to build new cryptosystems.

*Problem 8*. Can one devise syzygy-based cryptography?

**Acknowledgments.** The author learned a lot from the code-based cryptography seminar organized by Jean-Pierre Tillich at Inria Paris. More important perhaps, without his friendly pressure, probably this work would have stayed eternally in limbo. He should be thanked for all that. The very favourable environment towards research at ANSSI in general, and at LCR in particular, was also highly helpful. Henri Gilbert's advices led to improvements in several aspects of the presentation. Anonymous members of LCR unsuccessfully suggested the title "The Dyztynguysher" for this work.

The author is part of the ANR-21-CE39-0009 BARRACUDA and ANR-21-CE39-0008 KLEPTOMANIAC research projects. Some of the computations were done on the *lame* servers in Télécom Paris.

## References

1. Bardet, M., Mora, R., Tillich, J.P.: Polynomial Time Key-Recovery Attack on High Rate Random Alternant Codes. IEEE Trans. Inform. Theory **70**(6), 4492-4511 (2024)

2. Berlekamp, E.R., McEliece, R.J., van Tilborg, H.C.A.: On the inherent intractability of certain coding problems. IEEE Trans. Inform. Theory **IT-24**(3), 384-386 (1978)

3. Cascudo, I., Cramer, R., Mirandola, D., Zémor, G.: Squares of random linear codes. IEEE Trans. Inform. Theory **61**(3), 1159-1173 (2015)
4. Classic McEliece: conservative code-based cryptography: design rationale (23 October 2022), available at http://classic.mceliece.org/mceliece-rationale-20221023.pdf

5. Classic McEliece: conservative code-based cryptography: guide for security reviewers (23 October 2022), available at http://classic.mceliece.org/mceliece-security-20221023.pdf

6. Cooper, C.: On the distribution of rank of a random matrix over a finite field. Random Structures Algorithms 17(3-4), 197-212 (2000). https://doi.org/10.1002/1098-2418(200001/12)17:3/4<197::AID-RSA2>3.3.CO;2-B

7. Couvreur, A., Mora, R., Tillich, J.P.: A new approach based on quadratic forms to attack the McEliece cryptosystem. In: Guo, J., Steinfeld, R. (eds.) ASI-ACRYPT 2023, Part IV. LNCS, vol. 14441, pp. 3–38. Springer, Heidelberg, Germany, Guangzhou, China (Dec 4–8, 2023). https://doi.org/10.1007/978-981-99-8730-6_1

8. Couvreur, A., Otmani, A., Tillich, J.P.: Polynomial time attack on wild McEliece over quadratic extensions. In: Nguyen, P.Q., Oswald, E. (eds.) EUROCRYPT 2014. LNCS, vol. 8441, pp. 17–39. Springer, Heidelberg, Germany, Copenhagen, Denmark (May 11–15, 2014). https://doi.org/10.1007/978-3-642-55220-5_2

9. Eagon, J.A., Northcott, D.G.: Ideals defined by matrices and a certain complex associated with them. Proc. Roy. Soc. London Ser. A **269**, 188–204 (1962)

10. Eisenbud, D.: The geometry of syzygies, *Graduate Texts in Mathematics*, vol. 229. Springer-Verlag, New York (2005)

11. Eisenbud, D., Popescu, S.: Gale duality and free resolutions of ideals of points. Invent. Math. **136**(2), 419–449 (1999)

12. Faugère, J.C., Gauthier-Umaña, V., Otmani, A., Perret, L., Tillich, J.P.: A distinguisher for high-rate McEliece cryptosystems. *IEEE Trans. Inform. Theory* **59**(10), 6830–6844 (2013)

13. Gibson, J.K.: Equivalent Goppa codes and trapdoors to McEliece’s public key cryptosystem (rump session). In: Davies, D.W. (ed.) EUROCRYPT’91. LNCS, vol. 547, pp. 517–521. Springer, Heidelberg, Germany, Brighton, UK (Apr 8–11, 1991). https://doi.org/10.1007/3-540-46416-6_46

14. Goppa, V.D.: A new class of linear correcting codes. *Problemy Peredači Informacii* **6**(3), 24–30 (1970)

15. Green, M., Lazarsfeld, R.: Some results on the syzygies of finite sets and algebraic curves. *Compositio Math.* **67**(3), 301–314 (1988)

16. Hansen, J.P.: Linkage and codes on complete intersections. *Appl. Algebra Engrg. Comm. Comput.* **14**(3), 175–185 (2003)

17. Hirschowitz, A., Simpson, C.: La résolution minimale de l'idéal d'un arrangement général d'un grand nombre de points dans $\mathbf{P}^n$. *Invent. Math.* **126**(3), 467–503 (1996)

18. Johnsen, T., Verdure, H.: Stanley-Reisner resolution of constant weight linear codes. *DCC* **72**(2), 471–481 (2014)

19. Lorenzini, A.: The minimal resolution conjecture. *J. Algebra* **156**(1), 5–35 (1993)

20. Marquez-Corbella, I., Pellikaan, R.: Error-correcting pairs for a public-key cryptosystem (2012), *Code-based Cryptography Workshop 2012*, 9–11 May 2012, Lyn-gby, Denmark

21. McEliece, R.J.: A public-key cryptosystem based on algebraic coding theory (1978), DSN Progress Report 42-44

22. Mora, R., Tillich, J.P.: On the dimension and structure of the square of the dual of a Goppa code. *DCC* **91**(4), 1351–1372 (2023)
23. Mumford, D.: Lectures on curves on an algebraic surface, Annals of Mathematics Studies, vol. 59. Princeton University Press, Princeton, NJ (1966), with a section by G. M. Bergman

24. Patarin, J.: Hidden fields equations (HFE) and isomorphisms of polynomials (IP): Two new families of asymmetric algorithms. In: Maurer, U.M. (ed.) EUROCRYPT'96. LNCS, vol. 1070, pp. 33–48. Springer, Heidelberg, Germany, Saragossa, Spain (May 12–16, 1996). https://doi.org/10.1007/3-540-68339-9_4

25. Prange, E.: The use of information sets in decoding cyclic codes. *IRE Trans. IT-8*, S 5-S 9 (1962)

26. Randriambololona, H.: On products and powers of linear codes under component-wise multiplication. In: Algorithmic arithmetic, geometry, and coding theory, Contemp. Math., vol. 637, pp. 3–78. Amer. Math. Soc., Providence, RI (2015)

27. Rentería, C., Tapia-Recillas, H.: Linear codes associated to the ideal of points in $P^d$ and its canonical module. Comm. Algebra **24**(3), 1083–1090 (1996)

28. Verheul, E.R., Doumen, J.M., van Tilborg, H.C.A.: Sloppy Alice attacks! Adaptive chosen ciphertext attacks on the McEliece public-key cryptosystem. In: Information, coding and mathematics, Kluwer Internat. Ser. Engrg. Comput. Sci., vol. 687, pp. 99–119. Kluwer Acad. Publ., Boston, MA (2002)
# Supplementary material

## More on syzygies of shortened dual alternant and Goppa codes

It is possible to improve the lower bound on $\beta_{r-1,r}(C_s)$ in Theorem 1, using not only $\Phi = \Phi^{(0)}$, but also its conjugates $\Phi^{(1)}, \dots, \Phi^{(m-1)}$.

Let us first consider the simpler case $s = 0$.

The Eagon-Northcott complex of each such conjugate gives a subcomplex of the minimal resolution of $C$, however one should take care of the fact that in general these subcomplexes are not in direct sum. Proposition 3 gives a basis $s_{r; i_1, \dots, i_r}^{(j)}(\Phi^{(u)})$ for each syzygy space $M_{r-1,r}(\Phi^{(u)})$. The indices $i_1, \dots, i_r$ correspond to columns of $\Phi^{(u)} = (\mathbf{B}_0^{(u+e)} | \mathbf{B}_1^{(u+e-1)} | \dots | \mathbf{B}_e^{(u)})$. It is then easily seen:

**Proposition 9.** The $s_{r; i_1, \dots, i_r}^{(j)}(\Phi^{(u)})$ with column $i_1$ not in $\mathbf{B}_0^{(e+u)}$ also belong to $M_{r-1,r}(\Phi^{(u-1)})$. Conversely, for $e < m/2$, those with $i_1$ in $\mathbf{B}_0^{(e+u)}$ are linearly independent, hence form a basis of the subspace $V_r = M_{r-1,r}(\Phi^{(0)}) + \dots + M_{r-1,r}(\Phi^{(r)})$ of $M_{r-1,r}(C)$.

This gives the improved lower bound:

**Corollary 6.** Set $e = \lfloor \log_q(t-1) \rfloor$ and $f = (e+1)t - \frac{q^{e+1}-1}{q-1}$. Then for any $r \ge 2$ we have

$$ \beta_{r-1,r}(C) \ge \dim(V_r) = m(r-1) \left( \binom{f}{r} - \binom{f-(t-1)}{r} \right). \quad (97) $$

For $r = 2$ this specializes to

$$ \beta_{1,2}(C) \ge \dim(V_2) = \frac{m(t-1)}{2} \left( (2e+1)t - 2 \frac{q^{e+1}-1}{q-1} \right), \quad (98) $$

a result already proved in [12] by (essentially) the same method. It is observed moreover than in many cases the lower bound (98) is an equality, so we actually have

$$ I_2(C) = V_2. \quad (99) $$

Likewise for $r > f - (t-1)$ this gives

$$ \beta_{r-1,r}(C) \ge \dim(V_f) = m(r-1) \binom{f}{r} \quad (100) $$

and we will see examples where this is an equality.

However for arbitrary $r$, the improved lower bound (97) still isn't tight, because the inclusion $V_r \subseteq M_{r-1,r}(C)$ is strict in general. For instance, one can show that $M_{2,3}(C)$ contains syzygies of the form

$$ \begin{aligned} & X_a(X_{b+1}^{(u)} X_{c+1}^{(u+v)} - X_{b+q^v+1}^{(u)} X_c^{(u+v)}) - X_{a+q^u}(X_b^{(u)} X_{c+1}^{(u+v)} - X_{b+q^v}^{(u)} X_c^{(u+v)}) + \\ & \qquad + X_c^{(u+v)}(X_a X_{b+q^v+1}^{(u)} - X_{a+q^v} X_{b+q^v}^{(u)}) - X_{c+1}^{(u+v)}(X_a X_{b+1}^{(u)} - X_{a+q^u} X_b^{(u)}) = 0 \end{aligned} \quad (101) $$
that do not belong to $V_3$ in general.

In principle, under (99) it should be possible to use the explicit description of $V_2$ together with Proposition 2 to compute (the linear strand of) the minimal resolution of $C$. However the combinatorics appears quite complicated.

Now for general $s$, (68) and (73) can be extended to:

**Experimental fact 3.** Let $C$ be a dual alternant code. Then for all $s$ we have

$$r_{\max}(C_s) \geq r_{\max}(C) - s. \qquad (102)$$

It would be tempting to conjecture that (102) holds for all codes, but it turns out that one can find counterexamples. However, these counterexamples are quite rare. So maybe an interesting problem instead should be to give criteria for (102) to hold.

Observe that shortening is dual to puncturing. As the behaviour of minimal resolutions of codes under puncturing is quite well understood (Corollary 3), maybe the study of shortening should go hand-in-hand with that of code duality. Experiments suggest a loose link between $\beta_{r-2,r}(C^{\perp})$ and $\beta_{k-r,k+1-r}(C)$, at least for some regimes of parameters.

Back to dual alternant or Goppa codes, we actually observe a strong regular pattern (for Goppa codes the author only tested the irreducible case, but the result is likely to generalize):

**Experimental fact 4.** Let $\mathcal{T} = \text{Alt}^{\perp}$ or $\text{Gop}^{\text{irr},\perp}$ be a type of codes, namely, either dual alternant codes, or dual Goppa codes with irreducible Goppa polynomial. Let $q$ be a field cardinality, and $t \ge 3$ an integer.

1. For all $m$ large enough,

$$r_{\max}(C) = r_{\mathcal{T},q,t}^* \qquad (103)$$

is the same for generic proper $C \in \mathcal{T}_{q,m,q^m,t}$, i.e. it generically does not depend on $m$ nor on the choice of $C$, but only on $\mathcal{T}, q, t$.

Now $\mathcal{T}, q, t$ being fixed, we set $r^* = r_{\mathcal{T},q,t}^*$. Also, given $m, t$, we set $k = mt$.

2. For all $m$, for all $n \le q^m$, for generic proper $C \in \mathcal{T}_{q,m,n,t}$, and for all $s \le r^* - 2$, if $r^* - s > \max\left(\frac{(k-s)(k-s+1)}{n-s}, k - s + 1 - \text{d}_{\min}(C_s)\right)$, then

$$r_{\max}(C_s) = r^* - s. \qquad (104)$$

3. For $0 \le i \le r^* - 2$ there are functions $b_i(r)$ (actually depending on $\mathcal{T}, q, t$, so $b_i(r) = b_{i,\mathcal{T},q,t}(r)$) such that, for all $m$, for all $n \le q^m$, for generic proper $C \in \mathcal{T}_{q,m,n,t}$, for all $s \le r^* - 2$, and for all $r$ in the interval $2 \le r \le r^* - s$, if $r > \max\left(\frac{(k-s)(k-s+1)}{n-s}, k - s + 1 - \text{d}_{\min}(C_s)\right)$, then

$$\beta_{r-1,r}(C_s) = m b_{r^*-s-r}(r). \qquad (105)$$
4. We have $b_0(r) = r - 1$ independently of $\mathcal{T}, q, t$, so (105) reduces to

$$ \beta_{r^*-s-1, r^*-s}(C_s) = m(r^*-s-1). \quad (106) $$

More generally for $i \ge 1$ we have $b_i(r) = (r-1) \binom{r+i}{i}$ for a certain number of (but now, not for all) values of $\mathcal{T}, q, t$, so then (105) reduces to

$$ \beta_{r-1,r}(C_s) = m(r-1) \binom{r^*-s}{r}. \quad (107) $$

We observe that (68) gives a lower bound on $r^*$. For alternant codes, experimentally, this lower bound is an equality. However for Goppa codes this lower bound seems to be always a strict inequality. And even for binary Goppa codes, the improved lower bound (73) still is a strict inequality.

<table><caption>Fig. 4. s-shortened $\text{Alt}_{2,10,5}^{\perp}$ ($r^* = 8$)</caption><thead><tr><th>s</th><th>β<sub>1,2</sub></th><th>β<sub>2,3</sub></th><th>β<sub>3,4</sub></th><th>β<sub>4,5</sub></th><th>β<sub>5,6</sub></th><th>β<sub>6,7</sub></th><th>β<sub>7,8</sub></th></tr></thead><tbody><tr><td>0</td><td>251</td><td>1400</td><td>3230</td><td>2480</td><td><b>1400</b></td><td><b>480</b></td><td><b>70</b></td></tr><tr><td>1</td><td>202</td><td>880</td><td>1170</td><td><b>840</b></td><td><b>350</b></td><td><b>60</b></td><td>-</td></tr><tr><td>2</td><td>154</td><td>440</td><td><b>450</b></td><td><b>240</b></td><td><b>50</b></td><td>-</td><td>-</td></tr><tr><td>3</td><td>107</td><td><b>200</b></td><td><b>150</b></td><td><b>40</b></td><td>-</td><td>-</td><td>-</td></tr><tr><td>4</td><td>66</td><td><b>80</b></td><td><b>30</b></td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>5</td><td>31</td><td><b>20</b></td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>6</td><td><b>10</b></td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>7</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr></tbody></table>

<table><caption>Fig. 5. s-shortened $\text{Alt}_{3,5,6}^{\perp}$ ($r^* = 8$)</caption><thead><tr><th>s</th><th>β<sub>1,2</sub></th><th>β<sub>2,3</sub></th><th>β<sub>3,4</sub></th><th>β<sub>4,5</sub></th><th>β<sub>5,6</sub></th><th>β<sub>6,7</sub></th><th>β<sub>7,8</sub></th></tr></thead><tbody><tr><td>0</td><td>222</td><td>1943</td><td>1725</td><td><b>1120</b></td><td><b>700</b></td><td><b>240</b></td><td><b>35</b></td></tr><tr><td>1</td><td>193</td><td>1344</td><td><b>525</b></td><td><b>420</b></td><td><b>175</b></td><td><b>30</b></td><td>-</td></tr><tr><td>2</td><td>165</td><td>801</td><td><b>225</b></td><td><b>120</b></td><td><b>25</b></td><td>-</td><td>-</td></tr><tr><td>3</td><td>138</td><td>312</td><td><b>75</b></td><td><b>20</b></td><td>-</td><td>-</td><td>-</td></tr><tr><td>4</td><td>112</td><td><b>40</b></td><td><b>15</b></td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>5</td><td>87</td><td><b>10</b></td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>6</td><td>63</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>7</td><td>40</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr></tbody></table>

<table><caption>Fig. 6. s-shortened $\text{Gop}_{2,8,5}^{\perp}$ ($r^* = 17$)</caption><thead><tr><th>s</th><th>β<sub>1,2</sub></th><th>β<sub>2,3</sub></th><th>β<sub>3,4</sub></th><th>β<sub>4,5</sub></th><th>β<sub>5,6</sub></th><th>β<sub>6,7</sub></th><th>β<sub>7,8</sub></th><th>β<sub>8,9</sub></th></tr></thead><tbody><tr><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr><tr><td>8</td><td>280</td><td>3224</td><td>7464</td><td>4272</td><td><b>3360</b></td><td><b>1728</b></td><td><b>504</b></td><td><b>64</b></td></tr><tr><td>9</td><td>249</td><td>2510</td><td>1800</td><td><b>1792</b></td><td><b>1120</b></td><td><b>384</b></td><td><b>56</b></td><td>-</td></tr><tr><td>10</td><td>219</td><td>1856</td><td><b>840</b></td><td><b>672</b></td><td><b>280</b></td><td><b>48</b></td><td>-</td><td>-</td></tr><tr><td>11</td><td>190</td><td>1260</td><td><b>360</b></td><td><b>192</b></td><td><b>40</b></td><td>-</td><td>-</td><td>-</td></tr><tr><td>12</td><td>162</td><td>720</td><td><b>120</b></td><td><b>32</b></td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>13</td><td>135</td><td>234</td><td><b>24</b></td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>14</td><td>109</td><td><b>16</b></td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr></tbody></table>

<table><caption>Fig. 7. s-shortened $\text{Gop}_{3,6,5}^{\perp}$ ($r^* = 7$)</caption><thead><tr><th>s</th><th>β<sub>1,2</sub></th><th>β<sub>2,3</sub></th><th>β<sub>3,4</sub></th><th>β<sub>4,5</sub></th><th>β<sub>5,6</sub></th><th>β<sub>6,7</sub></th></tr></thead><tbody><tr><td>0</td><td>180</td><td>1293</td><td>3090</td><td>3144</td><td>960</td><td><b>36</b></td></tr><tr><td>1</td><td>151</td><td>810</td><td>1350</td><td>732</td><td><b>30</b></td><td>-</td></tr><tr><td>2</td><td>123</td><td>450</td><td>450</td><td><b>24</b></td><td>-</td><td>-</td></tr><tr><td>3</td><td>96</td><td>210</td><td>24</td><td>-</td><td>-</td><td>-</td></tr><tr><td>4</td><td>70</td><td>30</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>5</td><td>45</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>6</td><td>21</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>7</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr></tbody></table>

<table><caption>Fig. 8. s-shortened $\text{Gop}_{2,10,9}^{\perp}$ ($r^* = 38$)</caption><thead><tr><th>s</th><th>β<sub>1,2</sub></th><th>β<sub>2,3</sub></th><th>β<sub>3,4</sub></th><th>β<sub>4,5</sub></th><th>β<sub>5,6</sub></th><th>β<sub>6,7</sub></th></tr></thead><tbody><tr><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr><tr><td>32</td><td>719</td><td>8474</td><td><b>450</b></td><td><b>240</b></td><td><b>50</b></td><td>-</td></tr><tr><td>33</td><td>662</td><td>6216</td><td><b>150</b></td><td><b>40</b></td><td>-</td><td>-</td></tr><tr><td>34</td><td>606</td><td>4070</td><td><b>30</b></td><td>-</td><td>-</td><td>-</td></tr><tr><td>35</td><td>551</td><td>2034</td><td>-</td><td>-</td><td>-</td><td>-</td></tr></tbody></table>

Figures 4-8 illustrate the last Experimental fact. Boldface values match (107). This strongly suggests that the minimal resolution of the codes contains $m$ conjugate Eagon-Northcott complexes of length $r^*$, whose top degree components are in direct sum.
### Computing the Betti diagram of some families of codes

Regularity 2 helps in computing the full Betti diagram of codes, as one row can be deduced from the other. In order to illustrate this, let us first recall that a $[n, k]$-code $\mathcal{C}$ is MDS if it has dual minimum distance $d_{\min}(\mathcal{C}^{\perp}) = k + 1$.

**Lemma 12 ([15, Th. 1], reformulated).** Let $\mathcal{C}$ be a $[n, k]$-code with $n \le 2k - 1$. Assume $\mathcal{C}$ is MDS. Then for all $r \le 2k + 1 - n$ we have $\beta_{r-2,r}(\mathcal{C}) = 0$.

**Proposition 10.** Let $\mathcal{C}$ be a $[k+1, k]$ MDS code, for instance a parity code or a $[k+1, k]$ GRS code. Then the nonzero Betti numbers of $\mathcal{C}$ are $\beta_{0,0} = \beta_{k-1,k+1} = 1$, and

$$ \beta_{r-1,r} = \frac{(r-1)(k-r)}{k} \binom{k+1}{r} \quad (108) $$

for $2 \le r \le k - 1$. In particular they satisfy the symmetry $\beta_{i,j} = \beta_{k-1-i,k+1-j}$.

*Proof.* The parameters imply that $\mathcal{C}$ has regularity 2. By Lemma 12 we have $\beta_{r-2,r} = 0$ for $r \le k$. Then $\beta_{r-1,r} = \text{ind}(\varphi_r) = \binom{k(k+1)}{r} - (k+1)\binom{k-1}{r-2}$ and we conclude with a straightforward calculation.

**Proposition 11.** Let $\mathcal{C}$ be a $[2k - 1, k]$ GRS code. Then the nonzero Betti numbers of $\mathcal{C}$ are:

$$ \begin{aligned} - \beta_{0,0} &= 1 \\ - \beta_{r-1,r} &= (r-1) \binom{k-1}{r} \quad \text{for } 2 \le r \le k-1 \\ - \beta_{r-2,r} &= (r-2) \binom{k-1}{r-2} \quad \text{for } 3 \le r \le k+1 \quad (\text{so } \beta_{r-2,r} = \beta_{k+2-r,k+4-r}). \end{aligned} $$

In particular the ideal $I(\mathcal{C})$ is generated by $\beta_{1,2} = \frac{(k-1)(k-2)}{2}$ quadratic forms and $\beta_{1,3} = k - 1$ cubic forms.

*Proof.* Using the basis $\mathbf{y}, \mathbf{yx}, \dots, \mathbf{yx}^{k-1}$ of $\mathcal{C}$, we see $I_2(\mathcal{C})$ contains the $2 \times 2$ minors of $\mathbf{\Phi} = \binom{X_0 X_1 \dots X_{k-2}}{X_1 X_2 \dots X_{k-1}}$, i.e. $I_2(\mathcal{C}) \supset \text{im}(\wedge^2 \mathbf{\Phi})$ of dimension $\binom{k-1}{2}$.

Now set $n = 2k - 1$.

Because $n \ge 2k - 1$, we have $\text{dim } \mathcal{C}^{(2)} = 2k - 1$, hence $\text{dim } I_2(\mathcal{C}) = \binom{k-1}{2}$, so $I_2(\mathcal{C}) = \text{im}(\wedge^2 \mathbf{\Phi})$. Corollary 1 and the Eagon-Northcott complex of $\mathbf{\Phi}$ then give $\beta_{r-1,r} = (r-1)\binom{k-1}{r}$.

Because $n \le 2k - 1$, we have $\mathcal{C}^{(2)} = \mathbb{F}^n$. Then $\beta_{r-2,r} = \beta_{r-1,r} - \text{ind}(\varphi_r) = (r-1)\binom{k-1}{r} - \binom{k(k+1)}{r} - (2k-1)\binom{k-1}{r-2}$, and a straightforward calculation allows to conclude.

Figures 9 and 10 illustrate Propositions 10 and 11.

<table><caption>**Fig. 9.** a [9, 8] parity or GRS code</caption><thead><tr><th></th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th></tr></thead><tbody><tr><th>0</th><td>1</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><th>1</th><td>-</td><td>27</td><td>105</td><td>189</td><td>189</td><td>105</td><td>27</td><td>-</td></tr><tr><th>2</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>1</td></tr></tbody></table>

<table><caption>**Fig. 10.** a [15, 8] GRS code</caption><thead><tr><th></th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th></tr></thead><tbody><tr><th>0</th><td>1</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><th>1</th><td>-</td><td>21</td><td>70</td><td>105</td><td>84</td><td>35</td><td>6</td><td>-</td></tr><tr><th>2</th><td>-</td><td>7</td><td>42</td><td>105</td><td>140</td><td>105</td><td>42</td><td>7</td></tr></tbody></table>

*Exercise 1.* Compute the Betti diagram of $[n, k]$ GRS codes for $k+1 < n < 2k-1$.
Experimental data on defects for random codes

Figures 11-13 compare Betti diagrams for various types of codes of length $n = 23$ and dimension $k = 12$. Observe that these parameters give $\frac{k(k+1)}{n} \approx 6.78$.

First, Figure 11 presents the Betti diagram as predicted by the minimal resolution conjecture, i.e. with all defects equal to zero. It turns out that the minimal resolution conjecture is true for these parameters, so generic [23, 12]-codes over an infinite field actually have this Betti diagram. Such codes are MDS, i.e. they have $d = 12$ and $d^{\perp} = 13$, so the intervals $d^{\perp} \le r \le \frac{k(k+1)}{n}$ and $\frac{k(k+1)}{n} \le r \le k+1-d$ are empty, and Experimental fact 1 is trivially verified. Actually, codes with this Betti diagram can be found even over not-so-large finite fields, e.g. $q = 5$ suffices (the author did not search for optimality). These codes are no longer MDS, but they still have $d, d^{\perp} \ge 7$ and again Experimental fact 1 is trivially verified. Moreover, the converse Experimental fact 2 is also verified as all defects are zero.

<table><caption>Fig. 11. an idealized [23, 12]-code according to the minimal resolution conjecture</caption><thead><tr><th></th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>10</th><th>11</th></tr></thead><tbody><tr><th>0</th><td>1</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><th>1</th><td>-</td><td>55</td><td>319</td><td>880</td><td>1353</td><td>990</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><th>2</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>330</td><td>1617</td><td>1870</td><td>1221</td><td>485</td><td>110</td><td>11</td></tr></tbody></table>

<table><caption>Fig. 12. a (pseudo)random [23, 12]$_2$-code ($d = 3, d^{\perp} = 4$)</caption><thead><tr><th></th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>10</th><th>11</th></tr></thead><tbody><tr><th>0</th><td>1</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><th>1</th><td>-</td><td>55</td><td>319</td><td>884</td><td>1397</td><td>1224</td><td>490</td><td>121</td><td>18</td><td>1</td><td>-</td><td>-</td></tr><tr><th>2</th><td>-</td><td>-</td><td>4</td><td>44</td><td>234</td><td>820</td><td>1738</td><td>1888</td><td>1222</td><td>485</td><td>110</td><td>11</td></tr></tbody></table>

<table><caption>Fig. 13. the [23, 12]$_2$ Golay code ($d = 7, d^{\perp} = 8$)</caption><thead><tr><th></th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>10</th><th>11</th></tr></thead><tbody><tr><th>0</th><td>1</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><th>1</th><td>-</td><td>55</td><td>320</td><td>891</td><td>1408</td><td>1210</td><td>320</td><td>55</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><th>2</th><td>-</td><td>1</td><td>11</td><td>55</td><td>220</td><td>650</td><td>1672</td><td>1870</td><td>1221</td><td>485</td><td>110</td><td>11</td></tr></tbody></table>

Second, Figure 12 presents the Betti diagram of the binary code whose generator matrix

$$G = \begin{pmatrix} 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 1 & 1 & 0 & 1 \\ 0 & 1 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 0 & 1 & 0 \\ \vdots & & & & & & & & & & & & & & & & & & & & & & & \\ 0 & 1 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \end{pmatrix}$$

of size $12 \times 23$, is constructed from the binary expansion of $\pi$. We consider this code as representative of random codes. One can check that it has $d = 3, d^{\perp} = 4$. Then Experimental fact 1 is verified, as the defect is positive for $4 \le r \le 10$. Moreover at the extremities of this interval we have equality $\beta_{2,4} = A_4(C^{\perp}) = 4$.
and $\beta_{9,10} = A_3(C) = 1$, as predicted. And the defect is zero for $r < 4$ and $r > 10$ so Experimental fact 2 is verified also.

Last, Figure 13 reproduces Figure 3, the binary Golay code. As $d, d^{\perp} \ge 7$, Experimental fact 1 is trivially verified. On the other hand, Experimental fact 2 is not verified, but this only illustrates the fact that the Golay code is certainly not representative of random codes. Indeed it has a lot of algebraic structure, which explains it admitting special syzygies.

More systematically, Figure 14 presents statistics on $\text{def}(\varphi_r)$ ($2 \le r \le 8$) for random $[56, 16]_2$-codes. For each pair $(d, d^{\perp})$, a few thousands of codes with these parameters were sampled uniformly (using rejection sampling). The average value of $\text{def}(\varphi_r)$ among these samples is displayed, and also its 99% distribution interval (which means at most 0.5% fall below and at most 0.5% above).

Here we have $\frac{k(k+1)}{n} \approx 4.86$. Then, in accordance with Experimental fact 1, we can check $\text{def}(\varphi_r) > 0$ for $d^{\perp} \le r \le 4$ and for $5 \le r \le 17 - d$ (when applicable); while $\text{def}(\varphi_r) = 0$ with higher and higher probability as we move away from these intervals, in accordance with Experimental fact 2.

<table><caption>Fig. 14. some experimental data on $\text{def}(\varphi_r)$ for random $[56, 16]_2$-codes</caption><thead><tr><th></th><th colspan="2">d = 11</th><th colspan="2">d = 12</th><th colspan="2">d = 13</th><th colspan="2">d = 14</th></tr><tr><th></th><th>r</th><th>mean</th><th>99%</th><th>r</th><th>mean</th><th>99%</th><th>r</th><th>mean</th><th>99%</th></tr></thead><tbody><tr><td rowspan="8">d<sup>⊥</sup> = 3</td><td>2</td><td>0.000</td><td>[0, 0]</td><td>2</td><td>0.000</td><td>[0, 0]</td><td>2</td><td>0.000</td><td>[0, 0]</td></tr><tr><td>3</td><td>1.269</td><td>[1, 3]</td><td>3</td><td>1.245</td><td>[1, 3]</td><td>3</td><td>1.201</td><td>[1, 3]</td></tr><tr><td>4</td><td>23.821</td><td>[15, 55]</td><td>4</td><td>23.171</td><td>[15, 52]</td><td>4</td><td>21.975</td><td>[15, 48]</td></tr><tr><td>5</td><td>6.927</td><td>[5, 21]</td><td>5</td><td>1.948</td><td>[1, 8]</td><td>5</td><td>0.345</td><td>[0, 5]</td></tr><tr><td>6</td><td>1.341</td><td>[1, 7]</td><td>6</td><td>0.086</td><td>[0, 1]</td><td>6</td><td>0.006</td><td>[0, 1]</td></tr><tr><td>7</td><td>0.042</td><td>[0, 1]</td><td>7</td><td>0.001</td><td>[0, 0]</td><td>7</td><td>0.000</td><td>[0, 0]</td></tr><tr><td>8</td><td>0.000</td><td>[0, 0]</td><td>8</td><td>0.000</td><td>[0, 0]</td><td>8</td><td>0.000</td><td>[0, 0]</td></tr><tr><td></td><td>r</td><td>mean</td><td>99%</td><td>r</td><td>mean</td><td>99%</td><td>r</td><td>mean</td><td>99%</td></tr><tr><td rowspan="8">d<sup>⊥</sup> = 4</td><td>2</td><td>0.000</td><td>[0, 0]</td><td>2</td><td>0.000</td><td>[0, 0]</td><td>2</td><td>0.000</td><td>[0, 0]</td></tr><tr><td>3</td><td>0.000</td><td>[0, 0]</td><td>3</td><td>0.000</td><td>[0, 0]</td><td>3</td><td>0.000</td><td>[0, 0]</td></tr><tr><td>4</td><td>6.178</td><td>[1, 14]</td><td>4</td><td>5.963</td><td>[1, 14]</td><td>4</td><td>5.525</td><td>[1, 12]</td></tr><tr><td>5</td><td>6.514</td><td>[5, 20]</td><td>5</td><td>1.882</td><td>[1, 8]</td><td>5</td><td>0.357</td><td>[0, 5]</td></tr><tr><td>6</td><td>1.263</td><td>[1, 7]</td><td>6</td><td>0.090</td><td>[0, 1]</td><td>6</td><td>0.010</td><td>[0, 1]</td></tr><tr><td>7</td><td>0.035</td><td>[0, 1]</td><td>7</td><td>0.000</td><td>[0, 0]</td><td>7</td><td>0.001</td><td>[0, 0]</td></tr><tr><td>8</td><td>0.000</td><td>[0, 0]</td><td>8</td><td>0.000</td><td>[0, 0]</td><td>8</td><td>0.000</td><td>[0, 0]</td></tr><tr><td></td><td>r</td><td>mean</td><td>99%</td><td>r</td><td>mean</td><td>99%</td><td>r</td><td>mean</td><td>99%</td></tr><tr><td rowspan="8">d<sup>⊥</sup> = 5</td><td>2</td><td>0.000</td><td>[0, 0]</td><td>2</td><td>0.000</td><td>[0, 0]</td><td>2</td><td>0.000</td><td>[0, 0]</td></tr><tr><td>3</td><td>0.000</td><td>[0, 0]</td><td>3</td><td>0.000</td><td>[0, 0]</td><td>3</td><td>0.000</td><td>[0, 0]</td></tr><tr><td>4</td><td>0.000</td><td>[0, 0]</td><td>4</td><td>0.000</td><td>[0, 0]</td><td>4</td><td>0.000</td><td>[0, 0]</td></tr><tr><td>5</td><td>5.847</td><td>[5, 15]</td><td>5</td><td>1.485</td><td>[1, 6]</td><td>5</td><td>0.197</td><td>[0, 2]</td></tr><tr><td>6</td><td>1.153</td><td>[1, 6]</td><td>6</td><td>0.055</td><td>[0, 1]</td><td>6</td><td>0.002</td><td>[0, 0]</td></tr><tr><td>7</td><td>0.020</td><td>[0, 1]</td><td>7</td><td>0.001</td><td>[0, 0]</td><td>7</td><td>0.000</td><td>[0, 0]</td></tr><tr><td>8</td><td>0.000</td><td>[0, 0]</td><td>8</td><td>0.000</td><td>[0, 0]</td><td>8</td><td>0.000</td><td>[0, 0]</td></tr></tbody></table>
## Distinguishing Goppa codes with $q = 4$, $m = 4$, $t = 4$, irreducible Goppa polynomial

For these parameters, the square code distinguisher works down to $n_{\text{square}} = 97$, while the distinguisher of [7] works down to $n_{\text{CMT}} = 80$.

We experimentally find that dual Goppa codes C with these parameters, with $n = q^m = 256$, consistently have $r_{\text{max}} = 4$, which is better than the lower bound in Theorem 1 ($e = 0$, $r_{\text{max}} \ge t - 1 = 3$). Moreover, their Betti numbers are:

$$ \beta_{1,2}^* = 40, \quad \beta_{2,3}^* = 80, \quad \beta_{3,4}^* = 12. \qquad (109) $$

We then observe that the $\beta_{2,3}$-distinguisher works down to $n_{\beta_{2,3}} = 86$, and the $\beta_{3,4}$-distinguisher works down to $n_{\beta_{3,4}} = 68$, both of which coincide with (86). More precisely, computing the Betti numbers of dual Goppa and random codes around these values of $n$ consistently yields:

<table><thead><tr><th>n</th><th>88</th><th>87</th><th>86</th><th>85</th><th>84</th><th>70</th><th>69</th><th>68</th><th>67</th><th>66</th><th>...</th></tr></thead><tbody><tr><td>β<sup>Gop<sub>irr,⊥</sub></sup><sub>2,3</sub></td><td>80</td><td>80</td><td>80</td><td>85</td><td>100</td><td>310</td><td>325</td><td>340</td><td>355</td><td>370</td><td></td></tr><tr><td>β<sup>random</sup><sub>2,3</sub></td><td>40</td><td>55</td><td>70</td><td>85</td><td>100</td><td>310</td><td>325</td><td>340</td><td>355</td><td>370</td><td></td></tr><tr><td>β<sup>Gop<sub>irr,⊥</sub></sup><sub>3,4</sub></td><td>12</td><td>12</td><td>12</td><td>12</td><td>12</td><td>12</td><td>12</td><td>12</td><td>105</td><td>210</td><td></td></tr><tr><td>β<sup>random</sup><sub>3,4</sub></td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>105</td><td>210</td><td></td></tr></tbody></table>

We see that they stick to their “predicted” values: $\beta_{r-1,r} = \max(\beta_{r-1,r}^*, \text{ind}(\varphi_r)^+)$ for dual Goppa, and $\beta_{r-1,r} = \text{ind}(\varphi_r)^+$ for random codes.

## Distinguishing Goppa codes with $q = 2$, $m = 6$, $t = 3$, irreducible Goppa polynomial

For these parameters, the square code distinguisher works down to $n_{\text{square}} = 62$, while the distinguisher of [7] works down to $n_{\text{CMT}} = 59$.

We experimentally find that dual Goppa codes C with these parameters, with $n = q^m = 64$, consistently have $r_{\text{max}} = 8$, which is better than the lower bound in Corollary 4 ($\hat{e} = 1$, $r_{\text{max}} \ge 7$). Moreover, their top Betti numbers are:

$$ \beta_{5,6}^* = 1020, \quad \beta_{6,7}^* = 288, \quad \beta_{7,8}^* = 42. \qquad (110) $$

From (86) we expect to distinguish at $\beta_{5,6}$ for $n \ge 57$, at $\beta_{6,7}$ for $n \ge 49$, and at $\beta_{7,8}$ for $n \ge 43$.

And indeed at $n_{\beta_{5,6}} = 57$ we consistently find $\beta_{5,6} \ge 1020$ for dual Goppa codes, while $\beta_{5,6} < 500$ for random codes with quite high probability.

For smaller $n$ we have to pass to $\beta_{6,7}$. The $\beta_{6,7}$-distinguisher works well for $n = 56$, but the quality gradually falls (distinguishing errors occur more frequently) as $n$ becomes smaller. It is difficult to point a precise threshold where the distinguisher ceases to work. Arguably we still have a positive advantage at $n_{\beta_{6,7}} = 50$, but not anymore at $n = 49$. We could then try with $\beta_{7,8}$, but this fails too.
What happens? It turns out the conditions in Heuristic 1 are not satisfied anymore, so we cannot ensure $\mathrm{def}(\varphi_r) = 0$, or even $\mathrm{def}(\varphi_r)$ small, for these values of $r$ and $n$. Indeed, in order to have $\beta_{r-1,r} = 0$, we need $r > k + 1 - d$, where $d = \mathrm{d}_{\min}(C)$. For $r = 7$ and $k = mt = 18$ this gives $d \ge 13$. Then for smaller $d$, from Experimental fact 1, we expect a loose link between $\beta_{r-1,r}$ and the weight distribution of $C$. Recall the distinguisher still works as long as random codes satisfy $\beta_{r-1,r} < \beta_{r-1,r}^*$ with high enough probablity. Experimentally, for $r = 7$, we find this inequality is satisfied for random codes of minimum distance $d \ge 10$, while $d = 9$ is a borderline case, and $d \le 8$ fails invariably. Now what happens is that, as $n$ decreases from 56 to 50, the proportion of random codes with $d \ge 10$ also decreases, and they become minority for $n = 49$.

*Remark 3.* The sheer fact that the minimum distance is easily computable for codes with such small parameters actually provides a much more efficient alternative distinguisher. Indeed, turning back to the primal codes, the designed distance for binary Goppa codes with $t = 3$ is 7. Let us thus consider a distinguisher that decides that a given $[n, n-18]$-code is Goppa if it has $\mathrm{d}_{\min} \ge 7$, and that it is random otherwise. Experiments then show that, as long as $n \ge 32$, less than 2% of random codes with these parameters have $\mathrm{d}_{\min} \ge 7$. This means that this distinguisher has more than 99% success rate! And it remains remarkably effective even for smaller $n$. For instance, as low as $n = 24$, less than half random codes have $\mathrm{d}_{\min} \ge 7$, so this distinguisher still has more than 75% success rate.

In these experiments, random codes were defined by taking a uniformly random $(n-18) \times n$ generator matrix, which might quite often produce degenerate codes as $n$ approaches 18. Other probability distributions preventing this problem could be used, which would slightly alter the success rate, but not the qualitative behaviour of this distance-based distinguisher.