The canonical Z2s-linear Hadamard codes are the Gray images of the Z2s-additive codes. Their rank, the dimension of the binary linear span, was known in closed form only for s≤3, and for s≥4 only through computer computations for small lengths. We give a method that computes the rank for every s. We show that the rank is a binomial polynomial in the type parameters, with coefficients ρs(k) independent of the length. We compute all the coefficients for s≤5, which yields explicit rank formulas over Z4 and Z8 (recovering the known ones), and over Z16 and Z32.
Index Terms— Z2s-Hadamard codes, Gray map, rank
AMS classification—94B05, 94B60, 11T71.
1 Introduction
Let s≥1 and let Z2s be the ring of integers modulo 2s. The set of n-tuples over Z2s is denoted by Z2sn, and its elements are called vectors. The order o(u) of u∈Z2sn is the least positive integer m with mu=0. A Z2s-additive code is a subgroup C⊆Z2sn. It is of type (n;t1,…,ts) when
C≅Z2st1×Z2s−1t2×⋯×Z2ts.
A binary code C⊆F2N is Hadamard if ∣C∣=2N and any two distinct codewords differ in exactly N/2 coordinates. Equivalently, C consists of the rows of a Hadamard matrix together with their translates. Hadamard codes are closely related to designs [11, 24]. The linear Hadamard codes are exactly the first-order Reed–Muller codes RM(1,t), that is, the duals of the extended Hamming codes [24]. Most Hadamard codes are nonlinear, and their classification is a classical problem. Algebraic techniques for nonlinear codes are developed in [12]. A fruitful approach, initiated by the Z4-linear representation of the Kerdock, Preparata and Goethals codes [10], is to realise a nonlinear Hadamard code as the Gray image of an additive code over a ring Z2s or over a mixed alphabet, and then to decide which of the resulting codes are equivalent by means of invariants.
Carlet's Gray map ϕs:Z2s→F22s−1 is defined by
ϕs(u)=(us−1,…,us−1)+(u0,…,us−2)Ys−1,
where u=∑j=0s−1uj2j with uj∈{0,1} and the columns of the (s−1)×2s−1 binary matrix Ys−1 are all the vectors of F2s−1. Thus ϕ1 is the identity and ϕ2 is the classical Gray map. We
*The work of Minjia Shi was supported by the National Natural Science Foundation of China under Grants W2611002 and 12471490.
‡Corresponding author. School of Mathematical Sciences, Anhui University. Email: smjwcl.good@163.com write Φs=ϕs×n for the componentwise extension. If C⊆Z2sn is additive, then Φs(C) is called a Z2s-linear code, of length n2s−1. For every type a=(a1,…,as) with a1≥1, the recursive construction of [5, 17] produces a canonical Z2s-additive code Ha whose Gray image Ha is a binary Hadamard code of length 2t with
t+1=i=1∑s(s−i+1)ai.(1)
For s=2, the codes Ha are the Z4-linear Hadamard codes, which contain the Kerdock, Preparata and Goethals codes and the linear Hadamard codes [10]. Carlet's Gray map provides the Z2s-linear framework [6]. Codes over integer residue rings go back to Blake [13] and Shankar [26], and linear codes over Z2s were further studied in [21]. Several Gray maps and self-dual codes over Z2k are studied in [16]. Every Z2k-code is a binary propelinear code [20]. For every s, every Z2s-linear Hadamard code is permutation equivalent to one of the canonical codes Ha [7]. The classification problem for the family is therefore reduced to deciding when two types a and a′ give equivalent codes, and the two classical invariants for this comparison are the rank and the kernel.
The rank of a binary code C is the dimension rank(C)=dim⟨C⟩ of its linear span, and its kernel is
K(C)={x:x+C=C}.
We write ker(C)=dimK(C) for the dimension of the kernel. Since linear Hadamard codes are the first-order Reed–Muller codes, their rank is t+1 and their kernel is the whole code. For a nonlinear Hadamard code normalized so that 0∈C, the rank is strictly larger than the linear value t+1, while the kernel is a proper subcode, so both invariants carry information. If 0∈C then K(C) is a linear subcode of C, and if C is linear then K(C)=C=⟨C⟩. The pair (rank(C),ker(C)) is invariant under translations and permutations of coordinates, so two codes with different pairs are nonequivalent. The converse fails in general, and the failure is precisely what makes the classification of nonlinear Hadamard codes difficult. A substantial part of the literature is devoted to deciding, family by family, how far the pair (rank,ker) goes and which finer invariants are needed when it does not suffice.
For Z4-linear Hadamard codes either the rank or the kernel dimension classifies the family completely [22, 25]. There are exactly ⌊(t−1)/2⌋ nonequivalent such codes of length 2t for t≥3 [7]. For Z8-linear Hadamard codes the rank and the kernel dimension together give a complete classification, and the rank admits a closed formula [9]. The rank of the Z8-linear codes was also studied in [19]. For the mixed Z2Z4-linear and Z2Z4Z8-linear families the situation is more recent. The Z2Z4-linear Hadamard codes were classified in [23], and generator matrices and duality for Z2Z4-linear codes are given in [14]. The rank of every Z2Z4Z8-linear Hadamard code is now known in closed form, and the rank together with the kernel dimension classifies the family except for two infinite pairs of types [3]. The kernel-block rank profile, which records the dimensions of the spans of the code punctured on the blocks determined by its kernel, is constant on the nonlinear Z2Z4-linear and Z2s-linear families and, with a two-block refinement, completes the classification of the Z2Z4Z8-linear family [1]. In the pure Z2s family, the construction was developed in [17], the kernel was studied in [18], the linearity and the dimension of the kernel were determined in [7], and the equivalence classification was completed only recently [2], after the partial results of [7, 8]: for t≥3 there are P(t+1)−P(t)−1 nonequivalent Z2s-linear Hadamard codes of length 2t, where P is the partition function and s≥2 is allowed to vary. For odd primes the linearity and the kernel are treated in [5], the classification of the generalized Hadamard codes is completed in [2], and the relation between the ZpZp2-linear and the Zps-linear families is studied in [4].
The present paper is concerned with the remaining numerical invariant, the rank. For s≤3 it is known in closed form: for Z4,
rankHa1,a2=2a1+a2+(2a1−1),
and for Z8 the quartic formula of [9, Theorem 4.1]. For s≥4 no closed formula was known. The ranks used in the literature were obtained by computer algebra, one type at a time, and only for small lengths: the Z16 ranks of the admissible types of length 29, 210 and 211 are tabulated in [7, Table 3], the Z8-linear codes of length 2t are tabulated for t≤17 in [9], and [1, Section 7] and [2] recall that in the other cases the rank was computed with Magma [15] for small lengths. The recent closed formula for the mixed Z2Z4Z8 family [3] does not cover the pure Z2s family with s≥4. What is missing is a method that produces the rank for every s without treating the types and lengths one at a time.
The main result of this paper is such a method. We show that, for every s and every type a=(a1,…,as),
where the coefficients ρs(k) depend only on the alphabet exponent s and on the multiplicity vector k=(k0,…,ks−1), and neither on the type nor on the length. The sum is finite, over the feasible vectors with ∑ℓ2ℓkℓ≤2s−1. Their number is
for s=2,3,4,5,…, where b is the binary partition function. The proof is a support decomposition of the digit space: the exact-support projections ΠS split the space of message functions into a direct sum of local spaces Ws(S), and ρs(k) is the dimension of any one of them (Theorem 8). The coefficients are computed by a finite exact algorithm (Algorithm 1) based on the coefficient representation of Lemma 5. For s≤5 this yields complete coefficient tables, from which we recover the known closed formulas over Z4 and Z8 and obtain explicit binomial polynomials over Z16 and Z32. The Z16 values reproduce every entry of [7, Table 3]. For general s we do not claim a single closed formula: what is proved is the representation (2) together with the finite algorithm, and Section 4 discusses what a compact description of ρs(k) for general s would amount to.
The paper is organized as follows. Section 2 fixes the concepts and the notation. Section 3 presents the rank formula in terms of ρs(k) and the binomial coefficients. Section 4 deals with the ranks over Z4, Z8, Z16 and Z32, tabulates the coefficients for s≤5, and discusses the compact description for general s. Section 5 concludes the paper. Appendix A contains the pseudocode and its correctness proof.
2 Concepts and notations
2.1 Carlet's Gray map
For u=∑j=0s−1uj2j∈Z2s, Carlet's Gray map ϕs:Z2s→F22s−1 is
ϕs(u)=(us−1,…,us−1)+(u0,…,us−2)Ys−1,(3)
where the columns of the (s−1)×2s−1 binary matrix Ys−1 are all the vectors of F2s−1. Thus ϕ1 is the identity and ϕ2 is the classical Gray map. We put Φs=ϕs×n for the componentwise extension. We use the following additivity of ϕs, which is immediate from (3):
ϕs(2s−1λ+w)=ϕs(2s−1λ)+ϕs(w)(λ,w∈Z2s),
and the digit identity
2s−1(wmod2)=2s−1winZ2s,
because the two sides differ by 2s−1 times an even integer.
2.2 Z2s-Hadamard codes
Let s≥1 and let Z2s be the ring of integers modulo 2s. The order o(u) of u∈Z2s is the least m≥1 with mu=0. A Z2s-additive code is a subgroup C⊆Z2sn. It is of type (n;t1,…,ts) when C≅Z2st1×Z2s−1t2×⋯×Z2ts. For 1≤i≤s put
Ti={j2i−1:0≤j≤2s−i+1−1}=2i−1Z2s,
an ideal of Z2s of exponent 2s−i+1. A nonzero element of Ti may have a smaller order (for instance 2∈T1⊆Z8 has order 4), while a row ranging over the whole ideal has order 2s−i+1. A row of a generator matrix of C whose entries run over Ti has level i and order 2s−i+1. The order of an element w of Z2sn is the least m≥1 with mw=0. Thus a row of level i has order 2s−i+1.
Let a1,…,as be nonnegative with a1≥1 and m=a1+⋯+as. The canonical matrix Aa=Aa1,…,as has the m rows w1,…,wm, with w1 the all-one row, and as columns exactly all the vectors zT with
the entry zi is placed in the row wi+1. For 1≤i≤s exactly ai of the rows have level i, and the rows are ordered by increasing level. We let qi+1 be the level of the row wi+1, so that qi∈{0,…,s−1} is the valuation offset of the factor i, and then zi∈Tqi+1=2qiZ2s. The normalized coordinate of the factor i in the column z is
ζi=2qizi∈Z2s−qi,1≤i<m.(5)
Thus a column is described equivalently by its raw entries (1,z1,…,zm−1) or by its normalized coordinates (ζ1,…,ζm−1). We write G for Ga when the type is clear. We write Ha1,…,as for the Z2s-additive code generated by the rows of Aa1,…,as and Ha1,…,as=Φs(Ha1,…,as) for its Gray image, a binary Hadamard code of length 2t with (1) [7]. Every Z2s-additive Hadamard code is permutation equivalent to one of these, so we restrict to this family.
The binary coordinates of Ha1,…,as are indexed by pairs (z,h), where z runs over the columns (4) and h∈F2s−1 is the vector of Gray digits. The symbol h therefore has two readings, and we use both: for a fixed additive coordinate z, the 2s−1 vectors h∈F2s−1 label the binary coordinates attached to z, so that (z,h) is a single binary coordinate. Conversely, h is a summation index, as in ∑h∈F2s−1 or in (7), and we write h=(h0,…,hs−2) for its entries. For a message x=(b,x1,…,xm−1) we let u=u(x) be the corresponding codeword of Ha1,…,as and u(z) its entry at the additive coordinate z, which is a scalar. The entry is
Wx(z)=u(z)=b+i=1∑m−1xizi∈Z2s,(6)
where b is the coefficient of the all-one row w1 and xi the coefficient of the row wi+1. By (3), the value of Φs(u) at (z,h) is
where W0,…,Ws−1 are the binary digits of W, i.e. W=∑j=0s−1Wj2j with Wj∈{0,1}. Concretely, the value at the coordinate (z,h) is computed in three steps:
(i) expand the additive entry W=Wx(z) of (6) in base 2, obtaining the s bits W0,…,Ws−1.
(ii) view h=(h0,…,hs−2) as a vector of s−1 bits, one for each digit except the top one.
(iii) add in F2 the top bit and the low digits selected by h, as in (7).
Definition 1. The rank of the Z2s-additive code Ha=Ha1,…,as is the dimension of the span of codewords of Ha=Φs(Ha), denoted by rankHa=rankHa.
In this paper, we represent rankHa as a binomial polynomial in the type parameters, whose coefficients are computed by a finite exact algorithm. The following table collects the symbols used throughout the paper.
Index of notation
Symbol
Meaning
s, Z2s
alphabet exponent and ring, Ti=2i−1Z2s the ideal of level i
ϕs, Φs
Carlet's Gray map and its extension
a=(a1,…,as)
type: ai rows of level i, m=∑iai, a1≥1
Aa, or Aa1,…,as
the matrix
Ha, or Ha1,…,as
the Z2s-code generated by Aa
Ha, or Ha1,…,as
the Gray image of Ha
t
binary length 2t of Ha, with (1)
(z,h)
z∈Ga a column of Aa, written z=(1,z1,…,zm−1), and h∈F2s−1 the Gray vector
qi, ζi
level qi+1 of the row wi+1, raw entry zi∈Tqi+1, normalized ζi=zi/2qi (5)
ai,r
the r-th bit of the coefficient xi, 0≤r<s−qi
(b,x1,…,xm−1)
a message: b for w1, xi for wi+1
M
the set of messages
Wx(z)
the scalar entry b+∑i=1m−1xizi at the row x and column z (see (6))
digj
j-th binary digit of an element
rank
rank, the dimension of the span of Ha
ei, 1, 0
standard basis vectors, all-one and zero vectors
3 The rank formula
In this section, we will give the rank formula for a Z2s-Hadamard code Ha, where a=(a1,…,as) is the type and a1≥1.
For every element u∈Z2s, it can be uniquely expressed as
u=u0+u1⋅2+⋯+us−1⋅2s−1,uj∈{0,1}.
We denote uj by digj(u),0≤j<s. Let M be the set of all the messages x, i.e.,
M=Z2sa1×Z2s−1a2×⋯×Z2as.
In particular, for the message x=(b,x1,…,xm−1), M can also be written as
M=Z2s×Z2s−q1×⋯×Z2s−qm−1,
where b∈Z2s and, for 1≤i<m, xi∈Z2s−qi is the coefficient of a factor of level qi+1.
3.1 The digit space
By (7), the binary code Ha is obtained by evaluating, on the message set, the functions
Obviously, Fx,z,h is the entry of the code Ha whose row is indexed by x and column is indexed by (z,h). Thus, for fixed pair (z,h), the vector
Fz,h:=(Fx,z,h)x∈M
is exactly the column of Ha indexed by (z,h). Similarly, the vector Wz=(Wx(z))x∈M is a column of Ha over Z2s.
We compute the rank in the space of Boolean functions of the messages.
Lemma 2. Let
Vs=spanF2{digj(Wz):0≤j<s,z∈G}.
Then the column space of Ha is Vs. In particular rank Ha=dimVs.
Proof. The codewords of Ha are the rows Φs((Wx(z))z∈G), indexed by the messages x. Moreover, the entry in the row x and the column (z,h) is Fx,z,h. Let M be the transpose of Ha. Then, rank Ha=rankM=dim⟨M⟩, the dimension of the span of M. Recall that
If h=0, then Fx,z,h=digs−1(Wx(z)). If h=ej, then Fx,z,h=digs−1(Wx(z))+digj(Wx(z)). Hence, every column Fz,h of Ha is a combination of digj(Wz), so ⟨M⟩⊆Vs. Conversely, every digj(Wz) can be expressed by the sum of the columns Fz,h of Ha, i.e., Vs⊆⟨M⟩. Both inclusions give ⟨M⟩=Vs.
Put
Lz(x)=b+i=1∑m−12qixiζi,x=(b,x1,…,xm−1),
where ζi is the normalized coordinate (5) of the column z. Thus Lz(x) is the entry (6) of the codeword u(x) at the column z.
3.2 Boolean functions
The message set M=Z2s×∏i=1m−1Z2s−qi is a product of boxes, and a message function is a map f:M→F2. Writing every entry in base two, b=∑r=0s−1br2r and xi=∑r=0s−qi−1ai,r2r, the variables of f are the bits b0,…,bs−1 and the bits ai,r with 0≤r<s−qi. The normalized coordinates ζi of (5) are parameters.
In the bits u0,…,un−1, every Boolean function has a unique algebraic normal form (ANF)
f=S⊆{0,…,n−1}∑cSν∈S∏uν,cS∈F2,
because the 2n squarefree monomials are a basis of the F2-space of functions. A monomial is thus a squarefree product g=∏νuνeν, and its support is the set of factors G(g)={i:∃r,e(i,r)=1} whose bits occur in g. We also write supp(g)=G(g). The sum of the terms cgg with G(g)=S is the component of support S of f.
Let f be a message function and, for 1≤i<m, let Ei be the operator that sets the coefficient xi to zero:
Then Ei2=Ei and EiEj=EjEi. For U⊆{1,…,m−1} put EU=∏i∈UEi. Thus EU sets to zero all the coefficients xi with i∈U, i.e. all their bits, and E∅=id.
It is easy to check that
EUg={0,g,U∩G(g)=∅,U∩G(g)=∅,
since setting the coefficient of a factor to zero kills exactly the monomials that use it. Hence EU keeps the monomials whose support is disjoint from U.
Let Lj=digj∘Lz:M→F2, so that Lj(x)=digj(Lz(x)). Then Ei∘Lj is well defined and
Sc being the complement in the set of all nonconstant factors (the signs are redundant in F2). Indeed, for a monomial g of support G,
ΠSg=#{U:G⊆U⊆S}g=2∣S∣−∣G∣g={g,0,G=S,G=S.
because the number of U with G⊆U⊆S is 2∣S∣−∣G∣, which is even as soon as G is a proper subset of S. Consequently
ΠS2=ΠS,ΠSΠS′=0(S=S′),S∑ΠS=id,
so the components of support S of a message function f are the functions ΠSf, and f=∑SΠSf.
3.3 rank
For a column z∈G let ζi,1≤i<m, be its normalized coordinates (5). For a subset S⊆{1,…,m−1}, a message x=(b,x1,…,xm−1), and a digit j<s, define the following function
Proposition 3. The function Dj,S,ζS is a Boolean function from M to F2, and (Dj,S,ζS(x))x∈M∈Vs.
Proof. Every summand of Dj,S,ζS is of the form EUdigj(Lz) with U⊆S, so it suffices to show that Vs is stable under each projection EU. Let ζ(U) be the coordinate tuple that agrees with ζ on U and is zero elsewhere. It belongs to the canonical coordinate set, since the entries of a column are allowed to vanish. As EU sets to zero the coefficients xi with i∈/U, for every message
For a monomial g of Dj,S,ζS the support supp(g) is defined as in §3.2: it is the set of factors i∈S such that some bit ai,r occurs in g.
Lemma 4. Let Ws(S) be the span of the column vectors (Dj,S,ζS(x))x∈M as j<s and ζS vary. Then
(1) supp(g)=S for every monomial g of Dj,S,ζS(x)
(2) Vs=⨁SWs(S) is a direct sum of W(S)
(3) Ws(∅) is spanned by the s bits of b
Proof. Let g be a monomial with support G=supp(g) and let U be a set of factors. Then
EUcg={g,0,G⊆U,G⊆U,
because EUc sets to zero exactly the coefficients of the factors outside U. Hence
ΠSg=U⊆S∑EUcg=#{U:G⊆U⊆S}g.
If G⊆S the set of such U is empty and ΠSg=0. If G⊆S it has 2∣S∣−∣G∣ elements, because the part of U inside S∖G is free, so
ΠSg=2∣S∣−∣G∣g(G⊆S),
which is g when G=S and 0 when G is a proper subset of S, since then 2∣S∣−∣G∣ is even. This proves (1).
For (2): if f∈Ws(S), every monomial of f has support S. Hence for S=S′ the monomials occurring in Ws(S) and in Ws(S′) are distinct elements of the monomial basis, so the sum ∑SWs(S) is direct. Moreover ∑SΠS=id, so
digj(Lz)=S∑ΠSdigj(Lz)=S∑Dj,S,ζS,
and therefore the spaces Ws(S) span Vs. This gives (2).
For (3): Π∅ keeps the monomials of support ∅, i.e. those in the bits of b alone. Applied to digj(Lz) it gives digj(b), so Ws(∅) is spanned by b0,…,bs−1.
where αr=digr(x) are the bits of the coefficient x∈Z2s−q and ζ∈Z2s−q is a column value. For every message and every column, with L~z(x) a nonnegative integer representative of Lz(x)mod2s,
(1+T)L~z(x)=Bs(T)i=1∏m−1Aqi,ζi(xi;T).
Moreover, for 0≤j<s,
Dj,S,ζS=[T2j]Bs(T)i∈S∏(Aqi,ζi(xi;T)−1),
and Ws(S)=0 whenever ∑i∈S2qi>2s−1.
Proof. All identities are read in the ring of Boolean functions of the message bits with the formal variable T, truncated at T2s. We have the following steps.
(a) For an integer u≥0,
(1+T)u=r:digr(u)=1∏(1+T2r),
because (1+T)2r=1+T2r in characteristic two. As the integers ∑r∈J2r are distinct for distinct J, the coefficient of T2j is 1 exactly when digj(u)=1, i.e. [T2j](1+T)u=digj(u).
(b) For a coefficient x=∑r<s−qαr2r and a column value ζ,
the second equality using αr∈{0,1}. The product is finite because αr=0 for r≥s−q. For the all-one row, i.e. q=0, ζ=1 and x=b, this gives Bs(T).
(c) Let b~ and x~i be the integer representatives of b and xi modulo 2s and of xi modulo 2s−qi, and L~=b~+∑i2qix~iζi. Since (1+T)2s=1+T2s has no term of degree below 2s, the coefficients of degree <2s of (1+T)L~ depend only on L~mod2s. Hence
(f) The polynomial Aq,ζ(x;T)−1 has no term of degree below 2q, since its lowest power of T occurs in (1+T2q)ζ−1. Hence a product over the factors of S has no term of degree below ∑i∈S2qi. If this exceeds 2s−1 there is no coefficient of T2j with j<s, so Dj,S,ζS=0 and Ws(S)=0.
We complete the proof.
Recall that the row wi+1 has level qi+1, hence order 2s−qi. For a given S⊆{1,…,m−1}, define the multiplicity vector k=k(S)=(k0,k1,…,ks−1) as follows
kℓ:=∣{i∈S:qi=ℓ}∣,0≤ℓ<s.
Lemma 6. Let S,S′ be subsets of {1,…,m−1} with k=k(S)=k(S′). Then dimWs(S)=dimWs(S′).
Proof. Let σ be a bijection of the set of nonconstant factors that maps each factor of S to a factor of S′ of the same level. It exists because the two supports have the same number of factors at each level. On the message, σ relabels the coefficients within each level, which is the invertible linear substitution Tσ of the space of Boolean functions given by xi↦xσ(i). For a factor of level q+1 both its bits and its level are preserved, so Tσ sends Dj,S,ζS to Dj,S′,ζS′: in that definition only the levels of the factors of S, and the products 2qi, occur, and these are the same for the corresponding factor of S′. Hence Tσ maps Ws(S) onto Ws(S′), and since Tσ is invertible the two spaces have the same dimension.
Lemma 7. Let k be feasible and let S⊆{1,…,m−1} have k(S)=k. Then dimWs(S) depends only on s and k, and neither on the ambient type a nor on the length.
Proof. Let Ms,k=Z2s×∏ℓ=0s−1Z2s−ℓkℓ be the local message box of the multiplicity vector and let πS be the projection of the ambient message box onto the coordinates b and xi, i∈S. The functions Dj,S,ζS involve only these coordinates, so they are pullbacks πS∗D~j,S,ζS of functions D~ of the local box, and D↦πS∗D is injective because πS is surjective. An injective linear map preserves the dimension of every span, so dimWs(S) equals the dimension of the span of the D~j,S,ζS, which depends only on s and k. This also gives a meaning to ρs(k) for multiplicity vectors that do not occur in a given type.
Let ρs(k)=dimWs(S) for S with k=k(S). It is clear that ρs(k) is well-defined and depends only on s and k, by Lemma 6 and Lemma 7. Using Lemma 4, ρs(0)=dimW(∅)=s.
Theorem 8. For the type a=(a1,…,as), define μ0=a1−1 and μℓ=aℓ+1 for 1≤ℓ<s. Then
Proof. By Lemma 2 the rank is dimVs, and by Lemma 4,
rankHa=dimVs=S∑dimWs(S),
the sum running over all subset S of the set {1,…,m−1}. Grouping the sum over the supports according to their multiplicity vector k(S), and using Lemma 5 and Lemma 6, we get
rankHa=k:w(k)≤2s−1∑ρs(k)⋅∣{S:k(S)=k}∣,
(9) because dimWs(S)=ρs(k(S)) for every S and it vanishes when w(k(S))>2s−1, so each support contributes exactly one summand ρs(k(S)). By the definition of k(S) there are
∣{S:k(S)=k}∣=ℓ=0∏s−1(kℓμℓ)
supports of multiplicity k: one chooses kℓ of the μℓ factors of level ℓ+1 for each ℓ, and the choices at different levels are independent.
Remark 9. The computation is not uniformly inexpensive. The number of feasible supports is
Ns={k:ℓ∑2ℓkℓ≤2s−1}=4,10,36,202,…,
as s=2,3,4,5,…. The complexity grows with s, although it is finite for every fixed s.
4 Ranks over Z4, Z8, Z16 and Z32
Here we present the ranks over Z4, Z8, Z16, and Z32. The coefficients ρs(k) are computed by the Algorithm 1.
4.1 Explicit ranks over Z4
The vectors k satisfying Theorem 8 are (0,0),(1,0),(2,0),(0,1). The related ρ2 are 2,2,1,1, respectively. Hence,
For length 29 the six nonlinear admissible types give the ranks 11, 13, 12, 14, 17, 18 in the order of Table 3 of [7]. For t=10 the eight nonlinear admissible types give 12, 14, 17, 13, 15, 18, 19, 24, and for t=11 the ten of them give 13, 15, 18, 14, 16, 19, 23, 20, 25, 32. The ranks of the Z8-linear codes of length 2t for all t≤17 are tabulated in [9].
Table 2: The coefficients ρ3(k)
(k1,k2)
k0
ρ3(k)
(0,0)
0-4
3, 5, 4, 2, 1
(1,0)
0-2
2, 2, 1
(0,1)
0
1
(2,0)
0
1
4.3 The rank over Z16
For s=4 the rank is a binomial polynomial whose coefficients ρ4 are listed in Table 3 (36 feasible supports, of weights at most 23=8).
Table 3: The coefficients ρ4(k)
(k1,k2,k3)
k0
ρ4(k)
(0, 0, 0)
0-8
4, 10, 20, 27, 24, 17, 8, 2, 1
(1, 0, 0)
0-6
5, 9, 12, 11, 6, 2, 1
(0, 1, 0)
0-4
2, 4, 4, 2, 1
(2, 0, 0)
0-4
4, 5, 4, 2, 1
(0, 0, 1)
0
1
(1, 1, 0)
0-2
2, 2, 1
(3, 0, 0)
0-2
2, 2, 1
(0, 2, 0)
0
1
(2, 1, 0)
0
1
(4, 0, 0)
0
1
4.4 The rank over Z32
For s=5 the rank is a binomial polynomial whose coefficients ρ5 are listed in Table 4 (202 feasible supports, of weights at most 2s−1=16).
4.5 A talk for for general s
The tables of this section give explicit formulas for s≤5, but they do not by themselves reveal a pattern that could be extrapolated to general s. In this subsection we describe the form that a compact description of ρs(k) takes, and we settle the part of it that can be settled without further computation.
Let zi,r=digr(ζi) be the r-th binary digit of the normalized coordinate ζi (see (5)). For M=2qi+r,
(1+TM)ζi=j=0∏s−qi−1(1+zi,jTM2j),(12)
an identity in F2, because (1+TM)2j=1+TM2j and ζi=∑jzi,j2j. Hence the ζ-dependence of the local space is multi-affine: the variables zi,j occur at most to the first power. For a tuple T=(Ti)i∈S of subsets Ti⊆{0,…,s−qi−1} let
be the coefficient of the monomial ∏i∈S∏r∈Tizi,r in the corresponding digit coefficient. It is a Boolean function of the message bits, and it does not depend on ζ any more.
Lemma 10. With the notation above,
ρs(k)=dimF2span{Pj,T:0≤j<s,T=(Ti)i∈S},(13)
the span running over all j and all tuples T=(Ti)i∈S.
Proof. For fixed j, let M be the matrix with rows indexed by the tuples T and columns by the tuples ζS, and with entry MT,ζS=∏i∈S∏r∈Tizi,r(ζi). By (12) the coefficient Pj,T is the coefficient of the monomial ∏i∈S∏r∈Tizi,r in the polynomial Bs∏i∈S(Aqi,ζi−1), so
Dj,S,ζS(x)=T∑MT,ζSPj,T(x),
that is, the vector of generators indexed by ζS is MT times the vector indexed by T. The matrix M is the Kronecker product, over all bits zi,r, of the matrix (1011) (the evaluation of 1 and z
at z=0,1), hence it is invertible over F2. Therefore the two vectors have the same span, and the row spaces of the generators indexed by ζS and by T coincide.
Formula (13) is the compact description: ρs(k) is the rank of a single explicit matrix whose rows are indexed by the pairs (j,T), 0≤j<s, and whose columns are indexed by the message monomials. Each entry is the parity of the number of ways to write
2j=r∈J∑2r+i∈S∑r=0∑s−qi−12qi+rdi,r,
where J⊆{0,…,s−1} and 0≤di,r<2s−qi, the monomial carries br for r∈J and ai,r for di,r>0, and the binary digits of the di,r with the same i xor to Ti. In particular, since there are s⋅2∑i∈S(s−qi) rows,
ρs(k)≤s⋅2∑i∈S(s−qi).
The simplest instance of (13) is the maximal weight, where only one tuple T contributes. This gives the following boundary value of the coefficient table.
Proposition 11. If w(k)=∑ℓ2ℓkℓ=2s−1, then ρs(k)=1.
Proof. The lowest-degree term of Aqi,ζi(xi;T)−1 is ai,0ζi,0T2qi, and every other term of this polynomial has degree at least 2qi+1: either it uses a bit ai,r with r≥1, which contributes 2qi+r≥2qi+1, or it uses ai,0 together with a higher power of (1+T2qi)ζi−1, which contributes at least 2⋅2qi. Since w=2s−1, a product over i∈S has degree at least w, with equality only for the product of these lowest terms, which has degree exactly w. Multiplying by Bs(T) can only add degree, so the coefficient of T2s−1 is ∏i∈Sai,0ζi,0, while the coefficients of T2j with j<s−1 vanish. Hence every generator Dj,S,ζS is either 0 or the single function ∏i∈Sai,0, and the latter occurs when all ζi are odd. Thus Ws(S) is one-dimensional.
Proposition 11 explains the last entry of each row of the tables: whenever the weight w(k) reaches its maximum 2s−1, the coefficient is 1. For intermediate weights the matrix in (13) has no such collapse, and we do not know a uniform evaluation. This is the precise sense in which a closed formula for general s is still open: (13) reduces it to a single rank of an explicit matrix with s2∑(s−qi) rows, but it does not evaluate it.
5 Conclusion
We studied the binary rank of the canonical Z2s-linear Hadamard codes Ha. The main result is a representation theorem: for every type, the rank is a binomial polynomial in the parameters μ0=a1−1 and μℓ=aℓ+1,
rankHa=k∑ρs(k)ℓ=0∏s−1(kℓμℓ),
whose coefficients ρs(k) depend only on the alphabet exponent s and on the multiplicity vector k, and neither on the type nor on the length (Theorem 8 and Lemma 7). The coefficients ρs(k) are produced by a finite exact algorithm (Appendix A), based on the coefficient representation of Lemma 5: each local space is generated by the coefficients of T2j in the product Bs(T)∏i∈S(Aqi,ζi(xi;T)−1), and these polynomials are computed by truncated multiplication over F2 followed by elimination on monomials.
For s=2 and s=3 the sum collapses to compact closed forms, namely 2a1+a2+(2a1−1) and the quartic formula for Z8, both from [9]. For s=4 and s=5 one obtains explicit binomial polynomials in the type parameters whose coefficients are tabulated, with 36 and 202 feasible supports respectively (Tables 3 and 4). For arbitrary s we do not have a simple closed formula uniformly in s. What is proved is the representation theorem above together with a finite exact algorithm that computes ρs(k) for each fixed s.
Two questions remain open: an evaluation of these ranks in closed form for intermediate weights, and the ranks of the related families of mixed type, for which the same support decomposition applies but the local spaces differ.
Declaration of AI use
During the preparation and revision of this article, the authors used ChatGPT (OpenAI) and DeepSeek to assist with language refinement, the exploration and development of ideas, and improvements to the clarity. The authors reviewed and revised the AI-assisted content and take full responsibility for the results, the arguments, and the final form of the article.
A The algorithm to compute ρs(k)
We state the algorithm in pseudocode and prove that it computes ρs(k).
Algorithm 1 The coefficients of the rank formula
Require: s≥1 and a multiplicity vector k=(k0,…,ks−1) with ∑ℓ2ℓkℓ≤2s−1.
Ensure: ρs(k).
1: K←2s−1 and w←∑ℓ2ℓkℓ.
2: if w>K then
3: return 0
4: end if
5: Choose S with kℓ factors of level ℓ+1 for each ℓ. Let xi be the coefficient of the factor i∈S and ζi its column value.
6: for each i∈S do
7: Compute Fi(T)←Aqi,ζi(xi;T)−1 by multiplying successively the s−qi factors 1+ai,r((1+T2qi+r)ζi−1), truncating at TK+1 after each multiplication.
8: end for
9: P←∏i∈SFi(T), computed by successive multiplication truncated at TK+1, replacing the F2-span of the partial products by a basis of that span after each step.
10: P←P⋅Bs(T), truncated at TK+1.
11: for j=0,…,s−1 do
12: Collect the coefficient of T2j in P. It is a Boolean function of the message bits.
13: end for
14: return the dimension over F2 of the span of the collected functions, computed by Gaussian elimination on their monomials.
Theorem 12. For every s≥1 and every k with w(k)≤2s−1 the output of Algorithm 1 is ρs(k)=dimWs(S).
Proof. We justify the steps in turn.
(i) By Lemma 5, Aq,ζ(x;T)−1 is the product over 0≤r<s−q of the factors 1+αr((1+T2q+r)ζ−1). The successive multiplication therefore produces Fi, and truncating at TK+1 is harmless because every coefficient extracted later has degree at most K.
(ii) By Lemma 5 the space to be computed is generated by the coefficients of T2j, j<s, in Bs(T)∏i∈SFi(T). The product is formed by bilinearity over F2, and if g↦g⋅h denotes the multiplication by a fixed polynomial, which is linear, then replacing the span of the partial products by a basis of that span does not change the span obtained after multiplying by the remaining factors. Truncation is harmless by the first step. Moreover the product has no term of degree below w=∑i∈S2qi (the weight bound of Lemma 5). Hence when w>K there is no coefficient of T2j with j<s, the output 0 is correct, and when w≤K the degrees up to K suffice.
(iii) By Lemma 5 the coefficient of T2j in Bs∏i∈SFi is exactly the function Dj,S,ζS.
(iv) By definition ρs(k)=dimWs(S) is the dimension of the span of the functions Dj,S,ζS as j<s and ζS vary, and a set of Boolean functions, written in the algebraic normal form, is linearly independent if and only if the corresponding set of monomial vectors is. Gaussian elimination on the monomials therefore returns that dimension.
We complete the proof.
References
[1] D. K. Bhunia, The kernel-block rank profiles of the Z2Z4-linear and the Z2s-linear Hadamard codes, and a complete classification of the Z2Z4Z8-linear Hadamard codes, arXiv:2610.00142 (2026).
[2] D. K. Bhunia, Full classification of Zps-linear generalized Hadamard codes, arXiv:2610.18409 (2026).
[3] D. K. Bhunia, Rank and classification of Z2Z4Z8-linear Hadamard codes, arXiv:2609.06244 (2026).
[4] D. K. Bhunia, Nonequivalence of ZpZp2-linear and Zps-linear generalized Hadamard codes for odd primes, arXiv:2610.28306 (2026).
[5] D. K. Bhunia, C. Fernández-Córdoba and M. Villanueva, On the linearity and classification of Zps-linear generalized Hadamard codes, Des. Codes Cryptogr. 90 (2022) 1037–1058.
[6] C. Carlet, Z2k-linear codes, IEEE Trans. Inform. Theory 44(4) (1998) 1543–1547.
[7] C. Fernández-Córdoba, C. Vela and M. Villanueva, On Z2s-linear Hadamard codes: kernel and partial classification, Des. Codes Cryptogr. 87 (2019) 417–435.
[8] C. Fernández-Córdoba, C. Vela and M. Villanueva, Equivalences among Z2s-linear Hadamard codes, Discrete Math. 343(3) (2020) 111721.
[9] C. Fernández-Córdoba, C. Vela and M. Villanueva, On Z8-linear Hadamard codes: rank and classification, IEEE Trans. Inform. Theory 66(2) (2020) 970–982.
[10] A. R. Hammons, P. V. Kumar, A. R. Calderbank, N. J. A. Sloane and P. Solé, The Z4-linearity of Kerdock, Preparata, Goethals, and related codes, IEEE Trans. Inform. Theory 40(2) (1994) 301–319.
[11] E. F. Assmus Jr. and J. D. Key, Designs and Their Codes, Cambridge University Press, Cambridge, 1992.
[12] H. Bauer, B. Ganter and F. Hergert, Algebraic techniques for nonlinear codes, Combinatorica 3(1) (1983) 21–33.
[13] I. F. Blake, Codes over integer residue rings, Inform. Control 29(4) (1975) 295–300.
[14] J. Borges, C. Fernández-Córdoba, J. Pujol, J. Rifà and M. Villanueva, Z2Z4-linear codes: generator matrices and duality, Des. Codes Cryptogr. 54(2) (2010) 167–179.
[15] W. Bosma, J. Cannon and C. Playoust, The Magma algebra system I: the user language, J. Symbolic Comput. 24 (1997) 235–265.
[16] S. T. Dougherty and C. Fernández-Córdoba, Codes over Z2k, Gray map and self-dual codes, Adv. Math. Commun. 5(4) (2011) 571–588.
[17] C. Fernández-Córdoba, C. Vela and M. Villanueva, Construction and classification of the Z2s-linear Hadamard codes, Electron. Notes Discrete Math. 54 (2016) 247–252.
[18] C. Fernández-Córdoba, C. Vela and M. Villanueva, On the kernel of Z2s-linear Hadamard codes, in Coding Theory and Applications (ICMCTA), Lecture Notes in Computer Science 10495, Springer, 2017, 107–117.
[19] C. Fernández-Córdoba, C. Vela and M. Villanueva, On the rank of Z8-linear Hadamard codes, Electron. Notes Discrete Math. 70 (2018) 25–30.
[20] C. Fernández-Córdoba, J. Rifà and J. Borges, Every Z2k-code is a binary propelinear code, Electron. Notes Discrete Math. 10 (2001) 100–102.
[21] M. K. Gupta, M. C. Bhandari and A. K. Lal, On linear codes over Z2s, Des. Codes Cryptogr. 36(3) (2005) 227–244.
[22] D. S. Krotov, Z4-linear Hadamard and extended perfect codes, Electron. Notes Discrete Math. 6 (2001) 107–112.
[23] D. S. Krotov and M. Villanueva, Classification of the Z2Z4-linear Hadamard codes and their automorphism groups, IEEE Trans. Inform. Theory 61(2) (2015) 887–894.
[24] F. J. MacWilliams and N. J. A. Sloane, The Theory of Error-Correcting Codes, North-Holland, Amsterdam, 1977.
[25] K. T. Phelps, J. Rifà and M. Villanueva, On the additive (Z₄-linear and non-Z₄-linear) Hadamard codes: rank and kernel, IEEE Trans. Inform. Theory 52(1) (2006) 316–319.
[26] P. Shankar, On BCH codes over arbitrary integer rings, IEEE Trans. Inform. Theory 25(4) (1979) 480–483.