1 Introduction

The codes equipped with a metric differ from the Hamming metric has been studied for years. Poset metric was introduced by Brualdi (see [2]) in 1995. The concept of poset metric was motivated by Niederreiter’s generalization of a classical problem on coding theory (see [10] and [11]). In [7], Hyun and Kim introduced the concept of I-perfect codes and described the MDS poset codes in terms of I-perfect codes. They also studied the weight distribution of an MDS poset code and proved the duality theorem. Feng et al. (see [4]) introduced the block metric, by partitioning the set of coordinate positions of \({\mathbb {F}}_q^n\) into families of blocks. Later, Alves et al. introduced poset block metric (see [1]) and studied NRT block metric (see [12]). By extending their observations, Dass et al. studied poset block codes and defined a maximum distance separable poset block code. Moreover, they extended the concept of I-balls to poset block metric and described r-perfect and MDS \(({\mathbb {P}},\pi )\)-codes (see [3]). When all the blocks have the same dimension, they showed that MDS \(({\mathbb {P}},\pi )\)-codes are the same as I-perfect codes for some ideals I.

Recently, Irrinki and Selvaraj (see [8]) introduced pomset metric and enhanced the concept of order ideals. Construction of pomset codes are obtained and their metric properties like minimum distance and covering radius are determined. In [9], Irrinki and Selvaraj studied I-perfect codes under pomset metric by extending the concept of I-balls in poset metric. Moreover, they established a Singleton type bound for codes with pomset metric and investigated the connection between MDS codes and I-perfect codes. When the pomset is a chain, they proved the duality theorem and determined the weight distribution of MDS pomset codes.

A linear error-block code is a natural generalization of the classical error-correcting code and has applications in experimental design, high-dimensional numerical integration and cryptography. The construction of linear error-block codes with the largest rate, k/n, and the minimum distance d is an important problem in coding theory. The support of \(x\in {\mathbb {F}}_q^n\) given by \(supp(x)=\{i:x_i\ne 0\}\) is a set. The poset weight \(w_p(x)\) of x is defined as \(w_p(x)=|<supp(x)>|\) and \(d_p(x,y)=w_p(x-y)\) is a well defined metric on \({\mathbb {F}}_q^n\). One can get different metric on \({\mathbb {F}}_q^n\) by varying posets such as Rosenbloom–Tsfasman (RT)-metric if P is a chain, Hamming metric if P is an antichain and so on. In 2008, Firer et al. ([1]) presented the family of metrics called poset-block metric that generalizes all the previous ones. But the poset metric does not accodomate Lee metric for any particular poset. For an element \(l\in {\mathbb {Z}}_m\), the Lee weight of l is defined as \(w_L(l)=\min \{l,m-l\}\) whereas the Hamming weight of any \(l\ne 0\) is 1. Moreover, the Hamming weight of \(x=(x_1,x_2,\ldots ,x_n)\in {\mathbb {Z}}_m^n\) is sum of the Hamming weights of the non-zero coordinates, so that it counts the number of non-zero positions whereas Lee weight adds Lee weight of non-zero coordinates in x. Thus, the support of \(x\in {\mathbb {Z}}_m^n\) with respect to Lee weight is to be defined as \(supp_L(x)=\{k/i:k=w_L(x_i),k\ne 0\}\) which is a multiset. The pomset metric is a generalization to Lee metric when the pomset is an antichain. In this paper, we combine the pomset and block structure to obtain a further generalization called the pomset block metric. Pomset block codes reduces to the pomset codes with \(\pi =[1]^n\) and thus reduces to Lee metric with chain pomset. In some sense, it is a generalization to poset-block metric. By researching pomset-block codes, we give a much general method to handle Lee metric and error-block codes over \({\mathbb {Z}}_m\). This paper aims to introduce pomset block codes and extend the concept of I-perfect codes to the case of pomset block metric. A Singleton type bound for pomset block codes is established and the relationship between MDS codes and I-perfect codes is investigated. We also prove the duality result for I-perfect code when all the blocks have the same dimension. When the pomset is a chain and all the blocks have the same dimension, we determine the weight distribution of an MDS \(({\mathbb {P}},\pi )\)-code.

2 Preliminaries

In this section, we introduce some basic notations and useful results of a pomset block metric.

A collection of elements which may contain duplicates is called a multiset (in short, mset). Girish and John defined a multiset relation and explored some of basic properties (see [5] and [6]). They also defined a partially ordered multiset as a multiset relation being reflexive, antisymmetric and transitive, chains and antichains of a partially ordered multiset.

Formally, if X is a set of elements, a mset M drawn from the set X is represented by a function count \(C_{M}:X\rightarrow {\mathbb {Z}}_{+}\) where \({\mathbb {Z}}_{+}\) represents the set of non-negative integers. For each \(a\in X\), \(C_{M}(a)\) indicates the number of occurrences of the element a in M.

An element \(a\in X\) appearing p times in M is denoted by \(p/a\in M\) and thus \(C_M(a)=p\). If we consider \(k/a\in M\), the value of k satisfies \(k\le p\). The mset drawn from the set \(X=\{a_1,a_2,\ldots ,a_n\}\) is represented as \(M=\{p_1/a_1,p_2/a_2,\ldots ,p_n/a_n\}\). An mset is called regular if all its objects occur with the same multiplicity and the common multiplicity is called its height. The cardinality of an mset M drawn from X is \(|M|=\sum _{a\in X}C_M(a)\). The root set of M denoted by \(M^{*}\) is defined as \(M^{*}=\{a\in X:C_M(a)>0\}\).

Let \(M_1\) and \(M_2\) be two msets drawn from a set X. We call \(M_1\) a submset of \(M_2\) (\(M_1\subseteq M_2\)) if \(C_{M_1}(a)\le C_{M_2}(a)\) for all \(a\in X\). We call \(M_1\) a proper submset of \(M_2\) (\(M_1\subset M_2)\) if there exists at least one \(a\in M_2^*\) such that \(C_{M_1}(a)<C_{M_2}(a)\). Two msets \(M_1\) and \(M_2\) are equal (\(M_1=M_2\)) if \(M_1\subseteq M_2\) and \(M_2\subseteq M_1\).

Let \(M'\) be a submset of M. An element \(a\in M'^{*}\) is said to have full count with respect to M if \(C_{M'}(a)=C_{M}(a)\). \(M'\) is said to have full count if for all \(a\in M'^{*}\), one has \(C_{M'}(a)=C_{M}(a)\); otherwise, \(M'\) is said to be with partial count.

Let \(M_1\) and \(M_2\) be two msets drawn from a set X. Addition (sum) of \(M_1\) and \(M_2\) denoted by \(M=M_1\oplus M_2\) is defined as \(C_{M}(a)=C_{M_1}(a)+C_{M_2}(a)\) for all \(a\in X\). Subtraction (difference) of \(M_2\) from \(M_1\) denoted by \(M=M_1\ominus M_2\) is defined as \(C_M(a)=\max \left\{ C_{M_1}(a)-C_{M_2}(a),0\right\} \) for all \(a\in X\). The union of \(M_1\) and \(M_2\) is an mset denoted by \(M=M_1\cup M_2\) such that for all \(a\in X\), \(C_M(a)=\text {max}\{C_{M_1}(a),C_{M_2}(a)\}\).

The mset space \([X]^{l}\) is the set of all msets drawn from X such that no element in an mset occurs more than l times. If \(M_1,M_2\in [X]^l\), the mset sum would be modified as

$$\begin{aligned} C_{M_1\oplus M_2}(a)=\text {min}\left\{ l,C_{M_1}(a)+C_{M_2}(a)\right\} \hbox { for all } a\in X. \end{aligned}$$

Let \(M\in [X]^l\) be an mset, the complement \(M^{c}\) is an element of \([X]^l\) such that \(C_{M^{c}}(a)=l-C_{M}(a)\) for all \(a\in X\).

Let \(M_1\) and \(M_2\) be two msets drawn from X, the Cartesian product of \(M_1\) and \(M_2\) is also an mset defined as

$$\begin{aligned} M_1\times M_2=\{pq/(p/a,q/b):p/a\in M_1,q/b\in M_2\}. \end{aligned}$$

Denote by \(C_1(a,b)\) the count of the first coordinate in the ordered pair (ab) and by \(C_2(a,b)\) the count of the second coordinate in the ordered pair (ab).

A submset R of \(M\times M\) is said to be an mset relation on M if every member (p/aq/b) of R has count \(C_1(a,b)\cdot C_2(a,b)\). An mset relation R on an mset M is said to be reflexive if \(m/a\ R\ m/a\) for all \(m/a\in M\); antisymmetric if \(m/a\ R\ n/b\) and \(n/b\ R\ m/a\) imply \(m=n\) and \(a=b\); transitive if \(m/a\ R\ n/b\) and \(n/b\ R\ k/c\) imply \(m/a\ R\ k/c\). An mset relation R is called a partially ordered mset relation (or pomset relation) if it is reflexive, antisymmetric and transitive. The pair (MR) is known as a partially ordered multiset (pomset) denoted by \({\mathbb {P}}\).

Let \({\mathbb {P}}=(M,R)\) and \(m/a\in M\). Then m/a is a maximal element of \({\mathbb {P}}\) if there exists no \(n/b\in M\ (b\ne a)\) such that \(m/a\ R\ n/b\); m/a is a minimal element if there exists no \(n/b\in M\ (b\ne a)\) such that \(n/b\ R\ m/a\). \({\mathbb {P}}\) is called a chain if every distinct pair of points from M is comparable in \({\mathbb {P}}\). \({\mathbb {P}}\) is called an antichain if \(n/b\ R\ m/a\) implies \(a=b\).

A submset I of M is called an order ideal (or simply an ideal) of \({\mathbb {P}}\) if \(k/a\in I\) and \(q/b\ R\ k/a\) \((b\ne a)\) imply \(q/b\in I\). An ideal generated by an element \(k/a\in M\) is defined as

$$\begin{aligned} \langle k/a\rangle =\{k/a\}\cup \{q/b\in M: q/b\ R\ k/a\ \text {and}\ b\ne a\}. \end{aligned}$$

An ideal generated by a submset S of M is defined by \(\langle S\rangle =\bigcup \limits _{k/a\in S}\langle k/a\rangle \). We use \({\mathcal {I}}({\mathbb {P}})\) (resp. \(\mathcal {I}^{r}({\mathbb {P}}))\) to denote the set of all ideals of \({\mathbb {P}}\) (resp. of cardinality r). An ideal I is said to be an ideal with full count if \(C_{I}(a)=C_{M}(a)\) for all \(a\in I^{*}\), otherwise, I is said to be an ideal with partial count. We denote the set of all maximal elements in an ideal I by M(I).

Example 2.1

Let us consider the case \(M=\{2/1,2/2,2/3\}\) and R be a V-shape poset i.e., \(1<2\), \(1<3\) and 2, 3 are incomparable. Then the maximal elements of pomset \({\mathbb {P}}=(M,R)\) are 2/2 and 2/3 and the minimal element is 2/1. The ideals of \({\mathbb {P}}\) with cardinality 1 is \(I_1=\{1/1\}\), with cardinality 2 is \(I_2=\{2/1\}\), with cardinality 3 are \(I_3=\{2/1,1/2\}\) and \(I_4=\{2/1,1/3\}\), with cardinality 4 are \(I_5=\{2/1,2/2\}\), \(I_6=\{2/1,2/3\}\) and \(I_7=\{2/1,1/2,1/3\}\), with cardinality 5 are \(I_8=\{2/1,2/2,1/3\}\) and \(I_9=\{2/1,1/2,2/3\}\), with cardinality 6 is \(I_{10}=\{2/1,2/2,2/3\}\) respectively.

Proposition 2.1

([8]) Let \({\mathbb {P}}=(M,R)\) be a pomset. Then

  1. (1)

    for any \(I\in {\mathcal {I}}^r({\mathbb {P}})\) and \(0\le s\le r\le |M|\), there exists \(J\in {\mathcal {I}}^s({\mathbb {P}})\) such that \(J\subseteq I\).

  2. (2)

    for any \(I\in {\mathcal {I}}^r({\mathbb {P}})\) and \(0\le r\le s\le |M|\), there exists \(J\in {\mathcal {I}}^s({\mathbb {P}})\) such that \(I\subseteq J\).

For a given pomset \({\mathbb {P}}=(M,R)\), we define the dual pomset \(\widetilde{{\mathbb {P}}}=(M,{\widetilde{R}})\) as follows:

\({\mathbb {P}}\) and \(\widetilde{{\mathbb {P}}}\) have the same underlying set M and \(p/a\ R\ q/b\) in \({\mathbb {P}}\) if and only if \(q/b\ {\widetilde{R}}\ p/a\) in \(\widetilde{{\mathbb {P}}}\).

Proposition 2.2

([9]) Let \(M\in [X]^l\) be a regular mset with height l. Let \({\mathbb {P}}\) be a pomset on M and \(\tilde{{\mathbb {P}}}\) be its dual pomset. Then the order ideals of \(\tilde{{\mathbb {P}}}\) are precisely the complements of the order ideals of \({\mathbb {P}}\), that is, \(\mathcal {I}(\widetilde{{\mathbb {P}}})=\left\{ I^{c}:I\in \mathcal {I}({\mathbb {P}})\right\} \).

Consider \({\mathbb {Z}}_m=\{0,1,\ldots ,m-1\}\), the ring of integers modulo m for \(m\ge 4\). We consider a pomset \({\mathbb {P}}\) defined on an mset \(M=\left\{ \left\lfloor \frac{m}{2}\right\rfloor /1,\left\lfloor \frac{m}{2}\right\rfloor /2, \ldots ,\left\lfloor \frac{m}{2}\right\rfloor /s\right\} \in [X]^{\left\lfloor \frac{m}{2}\right\rfloor }\) where \(X=[s]\).

Let \(\pi : [s]\rightarrow {\mathbb {N}}\) be a map such that \(n=\sum \limits _{i=1}^{s}\pi (i)\). The map \(\pi \) is said to be a labeling of the pomset \({\mathbb {P}}\), and the pair \(({\mathbb {P}}, \pi )\) is called a pomset block structure over [s]. Denote \(\pi (i)\) by \(k_i\) and take \(V_i\) as free \({\mathbb {Z}}_m\)-module \({\mathbb {Z}}_m^{k_i}\) for all \(1\le i\le s\). Define V as

$$\begin{aligned} V=V_1\oplus V_2\oplus \cdots \oplus V_s \end{aligned}$$

which is isomorphic to \({\mathbb {Z}}_m^{n}\). Each \(u\in {\mathbb {Z}}_m^{n}\) can be written as \(u=(u_1,u_2,\ldots ,u_s)\) where \(u_i\in {\mathbb {Z}}_m^{k_i}\), \(1\le i\le s\). The Lee block support of \(u\in {\mathbb {Z}}_m^{n}\) is defined as

$$\begin{aligned} supp_{(L,\pi )}(u)=\left\{ s_i/i:s_i=w_{(L,\pi )}(u_i),s_i\ne 0\right\} , \end{aligned}$$

where

$$\begin{aligned} w_{(L,\pi )}(u_i)=\max \left\{ \min \left\{ u_{i_t}, m-u_{i_t}\right\} :1\le t\le \pi (i)\right\} . \end{aligned}$$

The \(({\mathbb {P}},\pi )\)-weight of \(u\in {\mathbb {Z}}_m^{n}\) is defined to be the cardinality of the ideal generated by \(supp_{(L,\pi )}(u)\), that is

$$\begin{aligned} w_{({\mathbb {P}},\pi )}(u)=\left| \langle supp_{(L,\pi )}(u)\rangle \right| . \end{aligned}$$

The pomset block distance between two vectors \(u,v\in {\mathbb {Z}}_m^{n}\) is defined as

$$\begin{aligned} d_{({\mathbb {P}},\pi )}(u,v)=w_{({\mathbb {P}},\pi )}(u-v). \end{aligned}$$

Now we prove that the above pomset block distance is a metric on \({\mathbb {Z}}_m^{n}\).

Theorem 1

Let \({\mathbb {P}}\) be a pomset on a regular mset \(M=\left\{ \left\lfloor \frac{m}{2}\right\rfloor /1,\left\lfloor \frac{m}{2}\right\rfloor /2, \ldots ,\left\lfloor \frac{m}{2}\right\rfloor /s\right\} \), and \(\pi :[s]\rightarrow {\mathbb {N}}\) such that \(n=\sum \limits _{i=1}^{s}\pi (i)\) be a labeling of \({\mathbb {P}}\). Then the pomset block distance \(d_{({\mathbb {P}},\pi )}(.,.)\) is a metric on \({\mathbb {Z}}_m^{n}\).

Proof

It is obvious that \(d_{({\mathbb {P}},\pi )}(u,v)\ge 0\) and \(d_{({\mathbb {P}},\pi )}(u,v)=0\) if and only if \(u=v\). Let \(u,v,w\in {\mathbb {Z}}_m^{n}\). Since \(supp_{(L,\pi )}(u-v)=supp_{(L,\pi )}(v-u)\), we have \(d_{({\mathbb {P}},\pi )}(v,u)=d_{({\mathbb {P}},\pi )}(u,v)\). It remains to show that \(d_{({\mathbb {P}},\pi )}(u,v)\le d_{({\mathbb {P}},\pi )}(u,w)+d_{({\mathbb {P}},\pi )}(w,v)\). Since \(d_{({\mathbb {P}},\pi )}(u,v)=w_{({\mathbb {P}},\pi )}(u-v)=w_{({\mathbb {P}},\pi )}(u-w+w-v)\), it suffices to show that the \(({\mathbb {P}},\pi )\)-weight satisfies the inequality \(w_{({\mathbb {P}},\pi )}(x+y)\le w_{({\mathbb {P}},\pi )}(x)+w_{({\mathbb {P}},\pi )}(y)\) for all \(x,y\in {\mathbb {Z}}_m^{n}\). We only need to prove that \(w_{(L,\pi )}(x_i+y_i)\le w_{(L,\pi )}(x_i)+w_{(L,\pi )}(y_i)\) for all \(i\in [s]\). Note that

$$\begin{aligned} w_{(L,\pi )}(x_i+y_i)=\max \left\{ \min \{x_{i_t}+y_{i_t},m-x_{i_t}-y_{i_t}\}: 1\le t\le \pi (i)\right\} . \end{aligned}$$

Suppose that \(w_{(L,\pi )}(x_i+y_i)=\min \{x_{i_1}+y_{i_1}, m-x_{i_1}-y_{i_1}\}\).

  • Case 1 Assume \(x_{i_1},y_{i_1}\le \left\lfloor \frac{m}{2}\right\rfloor \) and \(x_{i_1}+y_{i_1}\le \left\lfloor \frac{m}{2}\right\rfloor \). We have \(w_{(L,\pi )}(x_i+y_i)=x_{i_1}+y_{i_1}\). On the other hand, one has \(\min \{x_{i_1},m-x_{i_1}\}=x_{i_1}\le w_{(L,\pi )}(x_i)\) and \(\min \{y_{i_1},m-y_{i_1}\}=y_{i_1}\le w_{(L,\pi )}(y_i)\). Therefore, \(w_{(L,\pi )}(x_i+y_i)=x_{i_1}+y_{i_1}\le w_{(L,\pi )}(x_i)+w_{(L,\pi )}(y_i)\).

  • Case 2 Assume \(x_{i_1},y_{i_1}\le \left\lfloor \frac{m}{2}\right\rfloor \) and \(x_{i_1}+y_{i_1}> \left\lfloor \frac{m}{2}\right\rfloor \). Then \(w_{(L,\pi )}(x_i+y_i)=m-x_{i_1}-y_{i_1}\le x_{i_1}+y_{i_1}\le w_{(L,\pi )}(x_i)+w_{(L,\pi )}(y_i)\).

  • Case 3 Assume \(x_{i_1},y_{i_1}>\left\lfloor \frac{m}{2}\right\rfloor \) and \(x_{i_1}+y_{i_1}\le \left\lfloor \frac{m}{2}\right\rfloor \). We have \(w_{(L,\pi )}(x_i+y_i)=x_{i_1}+y_{i_1}-m\le \left\lfloor \frac{m}{2}\right\rfloor \). On the other hand, one has \(\min \{x_{i_1},m-x_{i_1}\}=m-x_{i_1}\le w_{(L,\pi )}(x_i)\) and \(\min \{y_{i_1},m-y_{i_1}\}=m-y_{i_1}\le w_{(L,\pi )}(y_i)\). So, \(w_{(L,\pi )}(x_i)+w_{(L,\pi )}(y_i)\ge m-x_{i_1}+m-y_{i_1}\ge \left\lfloor \frac{m}{2}\right\rfloor \) and hence \(w_{(L,\pi )}(x_i+y_i)\le \left\lfloor \frac{m}{2}\right\rfloor =w_{(L,\pi )}(x_i)+w_{(L,\pi )}(y_i)\).

  • Case 4 Assume \(x_{i_1},y_{i_1}>\left\lfloor \frac{m}{2}\right\rfloor \) and \(x_{i_1}+y_{i_1}>\left\lfloor \frac{m}{2}\right\rfloor \). Then \(w_{(L,\pi )}(x_i+y_i)=2\,m-x_{i_1}-y_{i_1}\le w_{(L,\pi )}(x_i)+w_{(L,\pi )}(y_i)\).

  • Case 5 Assume \(x_{i_1}\le \left\lfloor \frac{m}{2}\right\rfloor \), \(y_{i_1}>\left\lfloor \frac{m}{2}\right\rfloor \) and \(x_{i_1}+y_{i_1}>\left\lfloor \frac{m}{2}\right\rfloor \). We have \(w_{(L,\pi )}(x_i+y_i)=m-x_{i_1}-y_{i_1}\). On the other hand, one has \(\min \{x_{i_1},m-x_{i_1}\}=x_{i_1}\le w_{(L,\pi )}(x_i)\) and \(\min \{y_{i_1},m-y_{i_1}\}=m-y_{i_1}\le w_{(L,\pi )}(y_i)\). So, \(w_{(L,\pi )}(x_i)+w_{(L,\pi )}(y_i)\ge x_{i_1}+m-y_{i_1}\ge m-x_{i_1}-y_{i_1}=w_{(L,\pi )}(x_i+y_i)\).

  • Case 6 Assume \(x_{i_1}\le \left\lfloor \frac{m}{2}\right\rfloor \), \(y_{i_1}>\left\lfloor \frac{m}{2}\right\rfloor \) and \(x_{i_1}+y_{i_1}\le \left\lfloor \frac{m}{2}\right\rfloor \). Then \(w_{(L,\pi )}(x_i+y_i)=x_{i_1}+y_{i_1}-m\le x_{i_1}+m-y_{i_1}\le w_{(L,\pi )}(x_i)+w_{(L,\pi )}(y_i)\).

This completes our proof. \(\square \)

The metric \(d_{({\mathbb {P}},\pi )}(.,.)\) on \({\mathbb {Z}}_m^{n}\) is called a pomset block metric. The pair \(({\mathbb {Z}}_m^n, d_{({\mathbb {P}},\pi )})\) is said to be a pomset block space. A subset \({\mathcal {C}}\) of \(({\mathbb {Z}}_m^n,d_{({\mathbb {P}},\pi )})\) with cardinality K is called an (nKd) \(({\mathbb {P}},\pi )\)-code, where \({\mathbb {Z}}_m^n\) is equipped with the pomset block metric \(d_{({\mathbb {P}},\pi )}(.,.)\) and

$$\begin{aligned} d=d_{({\mathbb {P}},\pi )}({\mathcal {C}})=\min \left\{ w_{({\mathbb {P}},\pi )}(c-c'):c, c'\in {\mathcal {C}}\right\} \end{aligned}$$

is the \(({\mathbb {P}},\pi )\)-minimum distance of \({\mathcal {C}}\). If \({\mathcal {C}}\) is a submodule of \({\mathbb {Z}}_m^n\) with cardinality \(m^k\), we call \({\mathcal {C}}\) a linear \((n,m^k,d)\) \(({\mathbb {P}},\pi )\)-code. The dual of an (nKd) \(({\mathbb {P}},\pi )\)-code \(\mathcal {C}\) is defined as

$$\begin{aligned} {\mathcal {C}}^{\bot }=\left\{ v\in {\mathbb {Z}}_{m}^{n}:c\cdot v=c_1v_1+\cdots +c_nv_n=0\ \text {for all}\ c\in {\mathcal {C}}\right\} . \end{aligned}$$

3 Pomset balls and MDS \(({\mathbb {P}},\pi )\)-codes

3.1 r-balls

Let \({\mathbb {P}}\) be a pomset on \(M=\left\{ \left\lfloor \frac{m}{2}\right\rfloor /1,\left\lfloor \frac{m}{2}\right\rfloor /2, \ldots ,\left\lfloor \frac{m}{2}\right\rfloor /s\right\} \) and \(\pi \) be a labeling on \({\mathbb {P}}\). For \(u\in {\mathbb {Z}}_m^n\) and a non-negative integer r, the \(({\mathbb {P}}, \pi )\)-ball with center u and radius r is the set

$$\begin{aligned} B_r(u)=\left\{ v\in {\mathbb {Z}}_m^n:d_{({\mathbb {P}},\pi )}(u,v)\le r\right\} . \end{aligned}$$

The \(({\mathbb {P}},\pi )\)-sphere with center \(u\in {\mathbb {Z}}_m^n\) and radius r denoted by \(S_r(u)\) is defined as the set of all those vectors of \({\mathbb {Z}}_m^n\) whose pomset block distance is equal to r, that is,

$$\begin{aligned} S_r(u)=\left\{ v\in {\mathbb {Z}}_m^n:d_{({\mathbb {P}},\pi )}(u,v)=r\right\} . \end{aligned}$$

For simplify, \(B_r(u)\) and \(S_r(u)\) are also called r-ball and r-sphere centered at u respectively.

Definition 1

A \(({\mathbb {P}},\pi )\)-code \({\mathcal {C}}\) is said to be an r-error correcting \(({\mathbb {P}},\pi )\)-code if the \(({\mathbb {P}},\pi )\)-balls centered at the codewords of \({\mathcal {C}}\) are pairwise disjoint.

Definition 2

A \(({\mathbb {P}},\pi )\)-code \({\mathcal {C}}\) is said to be an r-perfect \(({\mathbb {P}},\pi )\)-code if the \(({\mathbb {P}},\pi )\)-balls of radius r centered at the codewords of \({\mathcal {C}}\) are pairwise disjoint and their union covers the entire space \({\mathbb {Z}}_m^n\).

We now consider the cardinality of an r-ball \(B_r(u)\) centered at \(u\in {\mathbb {Z}}_m^n\). It follows from the definition that \(|B_r(u)|=1+\sum \limits _{i=1}^{r}|S_i(u)|\). Let I be an ideal in the pomset \({\mathbb {P}}\) with cardinality i having exactly j maximal elements \(M(I)=\left\{ C_{I}(a_1)/a_1,C_{I}(a_2)/a_2,\ldots ,C_{I}(a_j)/a_j\right\} \). Then, the set

$$\begin{aligned} A_I= & {} \{v=(v_1,v_2,\ldots ,v_s)\in {\mathbb {Z}}_m^n: v_t={\bar{0}}\ \text {if}\ t\notin I^{*};\\{} & {} v_{t_i}=\pm a, -a\le v_{t_l}\le a, 1\le i\ne l\le k_t\ \text {if}\ t\in M(I)^{*}, a=C_{I}(t);\\{} & {} v_{t_i}\in {\mathbb {Z}}_m, 1\le i\le k_t,\ \text {if}\ t\in I^{*}\setminus M(I)^{*}\} \end{aligned}$$

gives all vectors v in \({\mathbb {Z}}_m^n\) such that \(\langle supp_{(L,\pi )}(v)\rangle =I\). By the definition of \(A_I\), we have \(|A_I|=m^{\sum \limits _{t\in I^{*}{\setminus } M(I)^{*}}k_t}\prod \limits _{l=1}^{j}N_{a_l}\) where \(N_{a_l}\) is defined as follows:

  • If m is odd, \(N_{a_l}=(2C_I(a_l)+1)^{k_{a_l}}-(2C_I(a_l)-1)^{k_{a_l}}\);

  • If m is even, \(N_{a_l}=\left\{ \begin{array}{ll} \dfrac{(2C_I(a_l)+1)^{k_{a_l}}-(2C_I(a_l)-1)^{k_{a_l}}}{2}, &{} \text {if}\ C_{I}(a_l)=\left\lfloor \frac{m}{2}\right\rfloor ; \\ (2C_I(a_l)+1)^{k_{a_l}}-(2C_I(a_l)-1)^{k_{a_l}}, &{} \text {otherwise.} \end{array} \right. \)

Note that for two distinct ideals \(I_1\) and \(I_2\), \(A_{I_1}\cap A_{I_2}=\varnothing \). Denote by \({\mathcal {I}}_j^i\) the collection of all ideals in \({\mathbb {P}}\) with cardinality i having exactly j maximal elements, then \(\bigcup \limits _{j=1}^{\min \{i,n\}}\mathcal {I}_{j}^{i}={\mathcal {I}}^{i}({\mathbb {P}})\) and \(\bigcup \limits _{j=1}^{\min \{i,n\}}\bigcup \limits _{I\in \mathcal {I}_j^i}A_I\) gives all those vectors of \(({\mathbb {P}},\pi )\)-weight i. Hence

$$\begin{aligned} |B_r(u)|=1+\sum \limits _{i=1}^{r}\sum \limits _{j=1}^{\min \{i,n\}} \sum \limits _{I\in {\mathcal {I}}_j^i\ne \varnothing } |A_{I}|=1+\sum \limits _{i=1}^{r}\sum \limits _{j=1}^{\min \{i,n\}} \sum \limits _{I\in {\mathcal {I}}_j^i\ne \varnothing }m^{\sum \limits _{t\in I^{*}\setminus M(I)^{*}}k_t}\prod \limits _{l=1}^{j}N_{a_l}. \end{aligned}$$

3.2 I-balls

Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\) and let I be a submset of M. For \(u\in {\mathbb {Z}}_m^n\), the I-ball centered at u is defined as

$$\begin{aligned} B_I(u)=\left\{ v\in {\mathbb {Z}}_m^n: supp_{(L,\pi )}(u-v)\subseteq I\right\} . \end{aligned}$$

For \(I\in {\mathcal {I}}({\mathbb {P}})\), the I-ball centered at u is equal to the set

$$\begin{aligned} B_I(u)=\left\{ v\in {\mathbb {Z}}_m^n:\ \langle supp_{(L,\pi )}(u-v)\rangle \subseteq I\right\} . \end{aligned}$$

Similarly, the I-sphere centered at u is defined as

$$\begin{aligned} S_{I}(u)=\left\{ v\in {\mathbb {Z}}_m^n:\ \langle supp_{(L,\pi )}(u-v)\rangle =I\right\} . \end{aligned}$$

We denote the I-ball (resp. I-sphere) centered at \({\bar{0}}\) by \(B_I\) (resp. \(S_I\)). Whenever required, we shall use the notation \(B_{I,({\mathbb {P}},\pi )}(u)\) (resp. \(S_{I,({\mathbb {P}},\pi )}(u)\)) instead of \(B_I(u)\) (resp. \(S_I(u)\)).

Definition 3

Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\) and I be an ideal of \({\mathbb {P}}\). A \(({\mathbb {P}}, \pi )\)-code \({\mathcal {C}}\subseteq {\mathbb {Z}}_m^n\) is said to be I-perfect if the I-balls centered at the codewords of \({\mathcal {C}}\) are pairwise disjoint and their union is \({\mathbb {Z}}_m^n\), that is,

$$\begin{aligned} {\mathbb {Z}}_m^n=\bigsqcup \limits _{u\in {\mathcal {C}}}B_I(u). \end{aligned}$$

The following proposition is a generalization of [9, Proposition 3] where the metric was considered as pomset metric. The proof is on similar lines and therefore we omit it.

Proposition 3.1

Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^{n}\). If I is an ideal with full count in \({\mathbb {P}}\), then

  1. (1)

    \(B_I\) is a submodule of \({\mathbb {Z}}_m^n\) of dimension \(\sum \limits _{i\in I^{*}}k_i\).

  2. (2)

    For \(u\in {\mathbb {Z}}_m^n\), \(B_I(u)\) is a coset of \(B_I\) containing u, that is, \(B_I(u)=u+B_I\).

  3. (3)

    For \(u,v\in {\mathbb {Z}}_m^n\), \(B_I(u)\) and \(B_I(v)\) are either disjoint or identical. Moreover

    $$\begin{aligned} B_I(u)=B_I(v)\ \text {if and only if}\ supp_{(L,\pi )}(u-v)\subseteq I. \end{aligned}$$
  4. (4)

    \(B_{I^{c},\widetilde{{\mathbb {P}}}}= B_{I,{\mathbb {P}}}^{\perp }\) where \(\widetilde{{\mathbb {P}}}\) is the dual pomset of \({\mathbb {P}}\).

Remark 3.1

  1. (a)

    The \(({\mathbb {P}},\pi )\)-ball centered at \(u\in {\mathbb {Z}}_m^n\) with radius r is the union of I-balls centered at u with \(I\in {\mathcal {I}}^{r}({\mathbb {P}})\), that is,

    $$\begin{aligned} B_r(u)=\bigcup \limits _{I\in {\mathcal {I}}^r({\mathbb {P}})}B_I(u). \end{aligned}$$
  2. (b)

    Let u, v be two vectors in \({\mathbb {Z}}_m^n\). If u and v belong to the same I-ball for some \(I\in \mathcal {I}^r({\mathbb {P}})\) with full count, then \(d_{({\mathbb {P}},\pi )}(u,v)\le r\).

  3. (c)

    Let u, v be two vectors in \({\mathbb {Z}}_m^n\) and let I be an ideal of \({\mathbb {P}}\) with partial count. If \(B_I(u)\cap B_I(v)=\emptyset \), the inequality \(d_{({\mathbb {P}},\pi )}(u,v)> |I|\) is not necessarily true.

The following result can be easily obtained from the definition of I-perfect codes which is similar to the case of poset block metric (see [3], Lemma 4.1).

Lemma 3.1

Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\). Let \({\mathcal {C}}\subseteq {\mathbb {Z}}_m^n\) be a linear \((n,m^k,d)\) \(({\mathbb {P}},\pi )\)-code and I be an ideal of \({\mathbb {P}}\) with full count. Then the following statements are equivalent:

  1. (1)

    \({\mathcal {C}}\) is an I-perfect code;

  2. (2)

    \(\sum \limits _{i\in I^{*}}k_i=n-k\) and \(|{\mathcal {C}}\cap B_I|=1\);

  3. (3)

    \(|{\mathcal {C}}\cap B_I(u)|=1\) for all \(u\in {\mathbb {Z}}_m^n\).

Writing \(u\in {\mathbb {Z}}_m^n\) as \((u_1,u_2)\) where \(u_1\in \mathop {\oplus }\limits _{j\notin I^{*}}V_j\) and \(u_2\in \mathop {\oplus }\limits _{i\in I^{*}}V_i\), we get the following.

Proposition 3.2

Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\) and I be an ideal of \({\mathbb {P}}\) with full count. Then, an \((n,m^k,d)\) \(({\mathbb {P}},\pi )\)-code \({\mathcal {C}}\) is I-perfect if and only if there exists a function

$$\begin{aligned} f:\mathop {\oplus }\limits _{j\notin I^{*}}V_j\rightarrow \mathop {\oplus }\limits _{i\in I^{*}}V_i \end{aligned}$$

such that

$$\begin{aligned} {\mathcal {C}}=\left\{ (v,f(v)): v\in \mathop {\oplus }\limits _{j\notin I^{*}}V_j\right\} . \end{aligned}$$

Proof

Let \({\mathcal {C}}\) be an I-perfect \((n,m^k,d)\)-code. Then for any \(v\in \mathop {\oplus }\limits _{j\notin I^{*}}V_j\) there exists \(c\in {\mathcal {C}}\) such that \((v,{\bar{0}})\in B_I(c)\) which implies that \(c-(v,{\bar{0}})=({\bar{0}},u)\) and hence \(c=(v,u)\). Suppose that there exists another element \(c'=(v,w)\in {\mathcal {C}}\). Then \(c-c'=({\bar{0}},u-w)\in B_I\) which implies that \(c\in B_I(c')\), a contradiction to the fact that \({\mathcal {C}}\) is I-perfect. Thus, the function \(f:\mathop {\oplus }\limits _{j\notin I^{*}}V_j\rightarrow \mathop {\oplus }\limits _{i\in I^{*}}V_i\) which sends \(v\in \mathop {\oplus }\limits _{j\notin I^{*}}V_j\) to the unique \(u\in \mathop {\oplus }\limits _{i\in I^{*}}V_i\) such that \(c=(v,u)\) is well-defined. Moreover, \(\left| \mathop {\oplus }\limits _{j\notin I^{*}}V_j\right| =m^k=|{\mathcal {C}}|\). We have \(\mathcal {C}=\left\{ (v,f(v)): v\in \mathop {\oplus }\limits _{j\notin I^{*}}V_j\right\} \).

On the other hand, if there exists such a function, then \(\mathcal {C}\cap B_I(v,u)=\{(v,f(v)\}\) for any \((u,v)\in {\mathbb {Z}}_m^n\). We obtain that \({\mathcal {C}}\) is I-perfect by Lemma 3.1. \(\square \)

Theorem 2

Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\) and I be an ideal with full count in \({\mathbb {P}}\). A linear \((n,m^k,d)\) \(({\mathbb {P}},\pi )\)-code \(\mathcal {C}\) is I-perfect if and only if \({\mathcal {C}}^{\bot }\) is an \(I^{c}\)-perfect \((\widetilde{{\mathbb {P}}},\pi )\)-code where \(\widetilde{{\mathbb {P}}}\) is the dual pomset of \({\mathbb {P}}\).

Proof

Let \({\mathcal {C}}\) be an I-perfect \(({\mathbb {P}},\pi )\)-code. By Lemma 3.1, \(I^c\) is an ideal in \(\widetilde{{\mathbb {P}}}\) with full count and satisfies that \(\sum \limits _{i\in {I^{c}}^{*}}k_i=k\). Consider the \(I^{c}\)-ball centered at \({\bar{0}}\in {\mathcal {C}}^{\bot }\). If there exists another element \({\bar{0}}\ne c\in {\mathcal {C}}^{\bot }\) in \(B_{I^c,(\widetilde{{\mathbb {P}}}, \pi )}\), then \(c\in B_{I,({\mathbb {P}},\pi )}^{\bot }\) by Proposition 3.1. Let \(v\in {\mathbb {Z}}_m^n\). Since \({\mathcal {C}}\) is an I-perfect code, there exists a unique \(c'\in {\mathcal {C}}\) such that \(v\in B_{I,({\mathbb {P}},\pi )}(c')\) which implies that \(v=c'+u\) for some \(u\in B_{I,({\mathbb {P}},\pi )}\). So, \(c\cdot v=c\cdot c'+c\cdot u=0\). Since v is arbitrary, we have \(c={\bar{0}}\). Therefore, \(\left| {\mathcal {C}}^{\bot }\cap B_{I^{c},(\widetilde{{\mathbb {P}}},\pi )}\right| =1\) and hence \(\mathcal {C}^{\bot }\) is \(I^{c}\)-perfect by Lemma 3.1. \(\square \)

Theorem 3

Let \({\mathcal {C}}\) be an r-error correcting \(({\mathbb {P}},\pi )\)-code where \(r\in {\mathbb {N}}\) is a multiple of \(\left\lfloor \frac{m}{2}\right\rfloor \). Then for any \(c,c'\in {\mathcal {C}}\), \(c\ne c'\) and \(I, I'\in {\mathcal {I}}^{r}({\mathbb {P}})\) with full count, one has \(c-c'\notin B_{I\oplus I'}\).

Proof

Assume that there exist \(c,c'\in {\mathcal {C}}\), \(c\ne c'\) and \(I,I'\in {\mathcal {I}}^{r}({\mathbb {P}})\) with full count satisfies \(c-c'\in B_{I\oplus I'}\). Denote by \(p_{B_{I^{*}}}\) the projection of \({\mathbb {Z}}_m^n\) on blocks corresponding to \(I^{*}\) and take \(u=c-p_{B_{I^{*}}}(c-c')\in {\mathbb {Z}}_m^n\). Then

$$\begin{aligned} d_{({\mathbb {P}},\pi )}(u,c)=w_{({\mathbb {P}},\pi )}(p_{B_{I^{*}}}(c-c'))\le \left\lfloor \frac{m}{2}\right\rfloor \cdot |I^{*}|=|I|=r. \end{aligned}$$

Analogously, we have

$$\begin{aligned}{} & {} d_{({\mathbb {P}},\pi )}(u,c')=w_{({\mathbb {P}},\pi )}\left( (c-c')-p_{B_{I^{*}}}(c-c') \right) \le w_{({\mathbb {P}},\pi )}\left( p_{B_{{I'}^{*}}}(c-c')\right) \\{} & {} \quad \le |I'^{*}|\cdot \left\lfloor \frac{m}{2}\right\rfloor =|I'|=r. \end{aligned}$$

This yields that \(u\in B_r(c)\cap B_r(c')\), a contradiction to the fact that \({\mathcal {C}}\) is r-error correcting. \(\square \)

Theorem 4

Let \({\mathcal {C}}\) be a \(({\mathbb {P}},\pi )\)-code. If for any \(c,c'\in {\mathcal {C}}\), \(c\ne c'\) and \(I, I'\in \mathcal {I}^{r}({\mathbb {P}})\), one has \(c-c'\notin B_{I\oplus I'}\). Then \({\mathcal {C}}\) is r-error correcting.

Proof

Assume that \({\mathcal {C}}\) is not an r-error correcting code. Then there exist \(c,c'\in {\mathcal {C}}\), \(c\ne c'\) and \(u\in {\mathbb {Z}}_m^n\) such that \(u\in B_r(c)\cap B_r(c')\). As \(d_{({\mathbb {P}},\pi )}(u,c)\le r\) and \(d_{({\mathbb {P}},\pi )}(u,c')\le r\), we have \(|\langle supp_{(L,\pi )}(u-c)\rangle |\le r\) and \(|\langle supp_{(L,\pi )}(u-c')\rangle |\le r\). Therefore, there exist \(I,I'\in I^r({\mathbb {P}})\) such that \(\langle supp_{(L,\pi )}(u-c)\rangle \subseteq I\) and \(\langle supp_{(L,\pi )}(u-c')\rangle \subseteq I'\) by Proposition 2.1. Hence

$$\begin{aligned}{} & {} supp_{(L,\pi )}(c-c')=supp_{(L,\pi )}(c-u+u-c')\\{} & {} \quad \subseteq supp_{(L,\pi )}(c-u)\oplus supp_{(L,\pi )}(u-c')\subseteq I\oplus I'. \end{aligned}$$

This implies that \(c-c'\in B_{I\oplus I'}\), a contradiction. \(\square \)

The following can be easily obtained from the definitions of r-ball and I-ball.

Proposition 3.3

Let \({\mathbb {P}}\) be a pomset on \(M=\left\{ \left\lfloor \frac{m}{2}\right\rfloor /1,\left\lfloor \frac{m}{2}\right\rfloor /2, \ldots ,\left\lfloor \frac{m}{2}\right\rfloor /s\right\} \) and \(({\mathbb {P}},\pi )\) a pomset block structure on \({\mathbb {Z}}_m^n\) such that \({\mathcal {I}}^r({\mathbb {P}})=\{I\}\). Let \({\mathcal {C}}\) be a \(({\mathbb {P}},\pi )\)-code. Then \({\mathcal {C}}\) is an r-perfect \(({\mathbb {P}},\pi )\)-code if and only if \({\mathcal {C}}\) is an I-perfect \(({\mathbb {P}},\pi )\)-code.

In the remainder of this section, we consider an ideal of \({\mathbb {P}}\) with partial count. Before this, we give some basic facts on the partition of \({\mathbb {Z}}_m^t\) when t is a positive integer.

Let \(\epsilon \in \left[ \lfloor \frac{m}{2}\rfloor -1\right] \). Let \(E=[-\epsilon ,\epsilon ]\) and \(E'=\{\epsilon +1,\epsilon +2,\ldots ,m-\epsilon -1\}\). Set

$$\begin{aligned} S=\left\{ v=(v_1,\ldots ,v_t)\in {\mathbb {Z}}_m^t: v_i\in E\ \text {for}\ 1\le i\le t\right\} . \end{aligned}$$

Let \(u=(u_1,\ldots ,u_t)\in S\setminus \{{\bar{0}}\}\). Take \(w=(w_1,\ldots ,w_t)\in S\) satisfying

$$\begin{aligned} w_i=\left\{ \begin{array}{ll} 0, &{} \text {if}\ u_i=0,\\ \epsilon -(u_i-1), &{} \text {if}\ 1\le u_i\le \epsilon ,\\ -\epsilon -(u_i+1), &{} \text {if}\ -\epsilon \le u_i\le -1. \end{array} \right. \end{aligned}$$

Then there exists at least one \(j\in [t]\) such that \(u_j+w_j\in E'\). Thus \(u+w\notin S\). On the other hand, we have \(u+w\in u+S\) and \(u\in u+S\). Hence we have the following result.

Proposition 3.4

Let \(u\in S\setminus \{{\bar{0}}\}\). Then \(S\cap (u+S)\ne \emptyset \) and \(S\ne u+S\).

Suppose that m is divisible by \(2\epsilon +1\). Let

$$\begin{aligned} T=\left\{ v=(v_1,\ldots ,v_t)\in {\mathbb {Z}}_m^t: v_i=t_i(2\varepsilon +1),\ 0\le t_i\le \frac{m}{2\epsilon +1}-1\ \text {for}\ 1\le i\le t\right\} . \end{aligned}$$

It is known that \(i(2\epsilon +1)+\beta \notin E\) for all \(\beta \in E\) whenever \(1\le i\le \frac{m}{2\varepsilon +1}-1\). It is also known that \(i(2\epsilon +1)+E\), \(j(2\epsilon +1)+E\) are disjoint for \(0\le i\ne j\le \frac{m}{2\varepsilon +1}-1\) (see [9]).

Lemma 3.2

Suppose that m is divisible by \(2\epsilon +1\). Then we have the followings:

  1. (1)

    For any \(v\in S\) and \({\bar{0}}\ne u\in T\), we have \(v+u\notin S\).

  2. (2)

    Let \(u\ne w\in T\), we have \(u+S\) and \(w+S\) are disjoint. Furthermore, \(\bigsqcup \limits _{u\in T}(u+S)={\mathbb {Z}}_m^t\).

Proof

  1. (1)

    Let \(v=(v_1,\ldots ,v_t)\in S\) and \({\bar{0}}\ne u=(u_1,\ldots ,u_t)\in T\). Then there exists \(i\in [t]\) such that \(u_i=t_i(2\epsilon +1)\ne 0\). Note that \(1\le t_i\le \frac{m}{2\varepsilon +1}-1\). It follows from \(v_i+u_i=v_i+t_i(2\epsilon +1)\notin E\) that \(u+v\notin S\).

  2. (2)

    Let \(u=(u_1,\ldots ,u_t),\ w=(w_1,\ldots ,w_t)\in T\). Suppose that \((u+S)\cap (w+S)\ne \emptyset \). Then there exist \(v=(v_1,\ldots ,v_t)\in S\) and \(v'=(v'_1,\ldots ,v'_t)\in S\) such that \(u+v=w+v'\). Since \(u\ne w\), there exists \(i\in [t]\) such that \(u_i\ne w_i\). Thus \(u_i+v_i=w_i+v'_i\), which contradicts to the fact that \(u_i+E\) and \(w_i+E\) are disjoint. The result then follows.

Corollary 3.1

If m is not divisible by \(2\epsilon +1\), then the translates of S can not form a partition of \({\mathbb {Z}}_m^t\).

We now let \(I\in {\mathcal {I}}({\mathbb {P}})\) be an ideal with partial count. Suppose that \(I_p=\{l_1,l_2,\ldots ,l_{\lambda }\}\subseteq I^{*}\) is the collection of the elements in \(I^{*}\) which has partial count in I and suppose that \(I_f=\{r_1,r_2,\ldots ,r_{\delta }\}\) is the collection of the elements in \(I^{*}\) which has full count in I. Then \(\lambda +\delta =\left| I^{*}\right| \). Since the pomset block metric is translation invariant, that is, for all \(u,v,w\in {\mathbb {Z}}_m^n\), \(d_{({\mathbb {P}},\pi )}(u,v)=d_{({\mathbb {P}},\pi )}(u+w,v+w)\), we have that \(B_I(u)=u+B_I\). Note that

$$\begin{aligned} B_I= & {} \left\{ v=(v_1,v_2,\ldots ,v_s)\in {\mathbb {Z}}_m^n: v_t={\bar{0}}\ \text {if}\ t\notin I^{*};\right. \nonumber \\{} & {} -a \le v_{t_j}\le a, a=C_{I}(t), 1\le j\le k_{t}\ \text {if}\ t\in I_p;\nonumber \\{} & {} \left. v_{t_j}\in {\mathbb {Z}}_m, 1\le j\le k_t,\ \text {if}\ t\in I_f\right\} \end{aligned}$$
(3.1)

and hence

$$\begin{aligned} \left| B_I\right| =\left( 1+2C_I(l_1)\right) ^{k_{l_1}}\left( 1+2C_I(l_2)\right) ^{k_{l_2}}\cdots \left( 1+2C_I(l_{\lambda })\right) ^{k_{l_{\lambda }}}m^{\sum \limits _{j\in I_f}k_j}. \end{aligned}$$

Remark 3.2

It follows from (3.1) that \(B_I\) is not a subgroup of \({\mathbb {Z}}_m^n\).

With the notations given above, we have the following result which can be easily obtained by counting argument.

Theorem 5

If m is divisible by \(2C_I(l_i)+1\) for all \(l_i\in I_p\) then the I-balls centered at the elements in

$$\begin{aligned} D= & {} \left\{ v=(v_1,v_2,\ldots ,v_s)\in {\mathbb {Z}}_m^n: v_t={\bar{0}}\ \text {if}\ t\in I_f;\right. \\{} & {} v_{t_i}=j(2C_I(t)+1), 0\le j\le \frac{m}{2C_I(t)+1}-1, 1\le i\le k_t\ \text {if}\ t\in I_p;\\{} & {} \left. v_{t_i}\in {\mathbb {Z}}_m, 1\le i\le k_t,\ \text {if}\ t\in [s]\setminus I^{*}\right\} \end{aligned}$$

partition the space \({\mathbb {Z}}_m^n\). Moreover, we have \(|D|=\mathop {\Pi }\limits _{t\in I_p}\left( \frac{m}{2C_I(t)+1}\right) ^{k_t}m^{\sum \limits _{i\in [s]{\setminus } I^{*}}k_i}\).

Corollary 3.2

If m is not divisible by \(2C_I(j)+1\) for some \(j\in I_p\), then no collection of I-balls will partition \({\mathbb {Z}}_m^n\).

Remark 3.3

Let \({\mathcal {C}}\subseteq {\mathbb {Z}}_m^n\) be an (nKd) \(({\mathbb {P}},\pi )\)-code.

  1. (1)

    If \({\mathcal {C}}\) is an r-perfect code, then for any \(I\in {\mathcal {I}}^r({\mathbb {P}})\), the I-balls centered at the codewords of \({\mathcal {C}}\) are disjoint.

  2. (2)

    If a \(({\mathbb {P}},\pi )\)-code \({\mathcal {C}}\) is I-perfect for some \(I\in {\mathcal {I}}^r({\mathbb {P}})\) with partial count, we can not guarantee that \({\mathcal {C}}\) is r-perfect since there may exist an ideal \(I'\in {\mathcal {I}}^{r}({\mathbb {P}})\) with partial count and \(u,v\in {\mathcal {C}}\) such that \(B_{I'}(u)\cap B_{I'}(v)\ne \emptyset \) (Example 3.1 will illustrate a counterexample).

  3. (3)

    Let m be a prime and let I be an ideal of \({\mathbb {P}}\) with partial count, then \({\mathcal {C}}\) can not be I-perfect \(({\mathbb {P}},\pi )\) for any \(I\in {\mathcal {I}}({\mathbb {P}})\) with partial count.

Example 3.1

Let \({\mathbb {P}}=(M,R)\) be a pomset where \(M=\{3/1,3/2\}\) and

$$\begin{aligned} R=\{(9/(3/1,3/1),9/(3/2,3/2)\}. \end{aligned}$$

Let \(\pi \) be a labeling of the pomset \({\mathbb {P}}\) such that \(\pi (1)=2\) and \(\pi (2)=1\). For \(I=\{1/1,3/2\}\), by the above discussion, we can find an I-perfect \(({\mathbb {P}},\pi )\)-code \(\mathcal {C}=\{(0,0,0),(3,0,0),(0,3,0),(3,3,0)\}\subseteq {\mathbb {Z}}_6^2\). Consider \(I'=\{2/1,2/2\}\in {\mathcal {I}}^4({\mathbb {P}})\). We observe that \((2,1,0)\in B_{I'}((3,0,0))\cup B_{I'}((0,3,0))\). Since \(B_r(u)=\bigcup \limits _{I\in {\mathcal {I}}^r({\mathbb {P}})}B_I(u)\), \({\mathcal {C}}\) is not 4-perfect. If \({\mathbb {P}}\) is a chain pomset with order relation \(3/2\ R\ 3/1\), then \(\mathcal {I}^4({\mathbb {P}})=\{I\}\) and \({\mathcal {C}}\) is a 4-perfect \(({\mathbb {P}},\pi )\)-code now.

Here is an example for a code being r-perfect but not I-perfect for any I with partial count.

Example 3.2

Let \({\mathbb {P}}=(M,R)\) be a pomset where \(M=\{2/1,2/2\}\) and

$$\begin{aligned} R=\{(4/(2/1,2/1),4/(2/2,2/2)\}. \end{aligned}$$

Let \(\pi \) be a labeling of the pomset \({\mathbb {P}}\) such that \(\pi (1)=\pi (2)=1\). Let \(r=1\). We have \(\mathcal {I}^1({\mathbb {P}})=\{I_1,I_2\}\) where \(I_1=\{1/1\}\), \(I_2=\{1/2\}\). Then \(B_1({\bar{0}})=\{(0,0),(0,1),(1,0),(0,4),(4,0)\}\). Consider the \(({\mathbb {P}},\pi )\)-code \(\mathcal {C}=\{(0,0),(1,2),(2,4),(3,1),(4,3)\}\subseteq {\mathbb {Z}}_5^2\). It is routine to verify that \({\mathcal {C}}\) is 1-perfect code. On the other hand, \({\mathcal {C}}\) can not be I-perfect for any \(I\in {\mathcal {I}}({\mathbb {P}})\) with partial count by the above discussion.

3.3 MDS \(({\mathbb {P}},\pi )\)-code

Theorem 6

(Singleton Bound) Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\) and \({\mathcal {C}}\subseteq {\mathbb {Z}}_m^n\) be an (nKd) \(({\mathbb {P}},\pi )\)-code. Denote by \(r=\left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \). Then

$$\begin{aligned} n-\lceil \log _mK\rceil \ge \max \limits _{I\in {\mathcal {I}}({\mathbb {P}}),|I^{*}|=r}\sum \limits _{i\in I^*}k_i. \end{aligned}$$
(3.2)

Proof

Let \(I\in {\mathcal {I}}({\mathbb {P}})\) be an ideal of \({\mathbb {P}}\) with \(|I^{*}|=r\). We may assume that I is full count, otherwise one can increase the counts of the maximal elements with partial count in I to \(\left\lfloor \frac{m}{2}\right\rfloor \). Take \(u,v\in \mathcal {C}\). If \(u_i=v_i\) for all \(i\in [s]{\setminus } I^*\). Then \(d_{({\mathbb {P}},\pi )}(u,v)\le |I|\le d-1\), a contradiction. This means that any two distinct codewords of \({\mathcal {C}}\) will differ in at least one position outside \(I^*\). Therefore there exists an injective map from \({\mathcal {C}}\) to \({\mathbb {Z}}_m^{n-\sum \limits _{i\in I^{*}}k_i}\) which implies that \(\log _mK\le n-\sum \limits _{i\in I^{*}}k_i\). Hence \(\lceil \log _mK\rceil \le n-\sum \limits _{i\in I^{*}}k_i\). From this, we get inequality (3.2). \(\square \)

Remark 3.4

Note that when \(k_i=1\) for all \(1\le i\le s\), inequality (3.2) would be

$$\begin{aligned} n-\lceil \log _mK\rceil \ge \left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor . \end{aligned}$$

This is the Singleton bound for pomset code, see [9, Theorem 2].

Definition 4

Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\). A \(({\mathbb {P}},\pi )\)-code \({\mathcal {C}}\) is said to be a maximum distance separable (MDS) \(({\mathbb {P}},\pi )\)-code if it attains the Singleton bound.

Example 3.3

Let \({\mathbb {P}}=(M,R)\) be a pomset on \(M=\{2/1,2/2,2/3,2/4\}\) and

$$\begin{aligned} R=\{4/(2/1,2/1),4/(2/2,2/2),4/(2/3,2/3),4/(2/4,2/4),4/(2/1,2/2),4/(2/3,2/4)\}. \end{aligned}$$

Let \(\pi \) be a labeling of the pomset \({\mathbb {P}}\) such that \(\pi (1)=\pi (3)=1\) and \(\pi (2)=\pi (4)=2\). Consider the \(({\mathbb {P}},\pi )\)-code \({\mathcal {C}}\subseteq {\mathbb {Z}}_5^6\) generated by the following matrix:

$$\begin{aligned} \left( \begin{array}{cccccc} 1 &{}\quad 0 &{}\quad 2 &{}\quad 2 &{}\quad 0 &{}\quad 1 \\ 0 &{}\quad 2 &{}\quad 4 &{}\quad 1 &{}\quad 1 &{}\quad 0 \\ \end{array} \right) . \end{aligned}$$

Then the code \({\mathcal {C}}\) is a linear \(({\mathbb {P}},\pi )\)-code of length 6 with \(d_{({\mathbb {P}},\pi )}({\mathcal {C}})=7\). We have \(\left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor =3\). The ideals in \({\mathbb {P}}\) such that \(|I^*|=3\) are

$$\begin{aligned}{} & {} \Big \{\{2/1,1/2,1/3\},\{2/1,1/2,2/3\},\{2/1,2/2,1/3\},\{2/1,2/2,2/3\},\\{} & {} \{1/1,2/3,1/4\}, \{1/1,2/3,2/4\},\{2/1,2/3,1/4\},\{2/1,2/3,2/4\}\Big \}. \end{aligned}$$

Thus

$$\begin{aligned} \max _{I\in {\mathcal {I}}({\mathbb {P}}),|I^*|=3}\sum _{i\in I^*}k_i=4=n-k. \end{aligned}$$

Therefore \({\mathcal {C}}\) is an MDS code.

Remark 3.5

Let \({\mathcal {C}}\) be an MDS (nKd) \(({\mathbb {P}},\pi )\)-code. Note that there always exists an ideal \(I\in {\mathcal {I}}({\mathbb {P}})\) with full count whose cardinality is \(\left\lfloor \frac{m}{2}\right\rfloor \cdot \left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \) such that \(\sum \limits _{i\in I^{*}}k_i=n-\lceil \log _mK\rceil \). Oterwise, assume that \(I\in {\mathcal {I}}({\mathbb {P}})\) is an ideal with partial count such that \(\sum \limits _{i\in I^{*}}k_i=n-\lceil \log _mK\rceil \). By increasing the counts of the maximal elements with partial counts in I, one can get the ideal J with full count whose cardinality is \(\left\lfloor \frac{m}{2}\right\rfloor \cdot \left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \) and satisfies that \(\sum \limits _{i\in I^{*}}k_i=n-\lceil \log _mK\rceil \).

Let m be a prime, that is, \({\mathbb {Z}}_m\) is a field. Let \({\mathcal {C}}\) be a linear \((n,m^k,d)\) \(({\mathbb {P}},\pi )\)-code. A generator matrix G and a parity check matrix H of \({\mathcal {C}}\) are defined as in the classical case. The parity check matrix H can be viewed as \(H=[H_1\ H_2\ \cdots \ H_s]\) where \(H_i\) is an \((n-k)\times k_i\) matrix. The set of blocks \(H_{l_1}, H_{l_2},\ldots , H_{l_r}\) is called linearly independent if, for \(\alpha _i\in V_{l_i}\),

$$\begin{aligned} H_{l_1}\alpha _1+H_{l_2}\alpha _2+\cdots +H_{l_r}\alpha _r={\bar{0}} \end{aligned}$$

deduces \(\alpha _i={\bar{0}}\) for all \(i\in [r]\). Otherwise the block set \(H_{l_1}, H_{l_2}, \ldots , H_{l_r}\) is called linearly dependent.

Let \({\mathbb {P}}=(M,R)\) be a pomset defined on the multiset \(M=\big \{\big \lfloor \frac{m}{2}\big \rfloor /1,\big \lfloor \frac{m}{2}\big \rfloor /2, \ldots ,\big \lfloor \frac{m}{2}\big \rfloor /s\big \}\). We can define a corresponding poset P with the underlying set \(\{1,\ldots ,s\}\) whose order relation is given by

\(a\le b\) in P if and only if \(p/a\ R\ q/b\) in \({\mathbb {P}}\).

Given a subset \(Q\subseteq [s]\), we denote by \(<Q>_P\) the smallest ideal of P containing Q. With these notations, we have the following.

Theorem 7

Let m be a prime. Let \({\mathcal {C}}\) be a linear \((n,m^k,d)\) \(({\mathbb {P}},\pi )\)-code and let H be a parity check matrix of \({\mathcal {C}}\). Then \({\mathcal {C}}\) has a codeword c such that \(\left| \langle supp_{(L,\pi )}(c)\rangle ^{*}\right| =t\) if and only if there exists an ideal I of \({\mathbb {P}}\) with \(|I^{*}|=t\) satisfying that the blocks of H corresponding to \(I^{*}\) are linearly dependent.

Proof

Let \(c=(c_1,c_2,\cdots ,c_s)\in {\mathcal {C}}\) satisfying \(\left| \langle supp_{(L,\pi )}(c)\rangle ^{*}\right| =t\). Let \(I=\langle supp_{(L,\pi )}(c)\rangle \). Then \(c_i\ne {\bar{0}}\) for \(i\in M(I)^{*}\) and \(c_i={\bar{0}}\) for \(i\notin I^{*}\). It follows from

$$\begin{aligned} H_1c_1+H_2c_2+\cdots +H_sc_s={\bar{0}} \end{aligned}$$

that the blocks of H corresponding to \(I^{*}\) are linearly dependent.

On the other hand, we suppose that the set of blocks \(H_{l_1},H_{l_2},\ldots ,H_{l_{\lambda }}\) are linearly dependent and suppose that there exist \({\bar{0}}\ne \alpha _{l_i}\in V_{l_i}\) such that

$$\begin{aligned} H_{l_1}\alpha _{l_1}+H_{l_2}\alpha _{l_2}+\cdots +H_{l_j}\alpha _{l_{\lambda }}={\bar{0}}. \end{aligned}$$

Let I be an ideal of \({\mathbb {P}}\) whose root set is \(I^{*}=<\{l_1,\ldots ,l_{\lambda }\}>_P\). Take \(c=(c_1,c_2,\ldots ,c_s)\in {\mathbb {Z}}_m^n\) such that

$$\begin{aligned} c_{l_i}=\left\{ \begin{array}{ll} \alpha _{l_i}, &{} \text {if}\ i\in [\lambda ],\\ {\bar{0}}, &{} \text {otherwise}. \end{array} \right. \end{aligned}$$

Then \(Hc={\bar{0}}\) which implies that \(c\in {\mathcal {C}}\). Furthermore, \(\langle supp_{(L,\pi )}(c)\rangle ^{*}=I^*\). This completes the proof. \(\square \)

Corollary 3.3

Let m be a prime. Let \({\mathcal {C}}\) be a linear \(({\mathbb {P}},\pi )\)-code and let H be a parity check matrix of \({\mathcal {C}}\). Then

$$\begin{aligned} \min \left\{ \left| \langle supp_{(L,\pi )}(c)\rangle ^{*}\right| ,\ c\in {\mathcal {C}}\right\} =t \end{aligned}$$

if and only if

$$\begin{aligned} t=\min \left\{ j: I\in {\mathcal {I}}({\mathbb {P}})\ \text {satisfies}\ |I^{*}|=\{l_1,\ldots ,l_j\},\ rank\{H_{l_1},\ldots ,H_{l_j}\}<\sum \limits _{i=1}^j k_{l_i}\right\} . \end{aligned}$$

Since

$$\begin{aligned} \left\lfloor \frac{d}{\left\lfloor \frac{m}{2}\right\rfloor } \right\rfloor \le \min \left\{ \left| \langle supp_{(L,\pi )}(c)\rangle ^{*}\right| ,\ c\in {\mathcal {C}}\right\} , \end{aligned}$$

we have the following.

Remark 3.6

Let m be a prime. Let \({\mathcal {C}}\) be a linear \(({\mathbb {P}},\pi )\)-code and let H be a parity check matrix of \({\mathcal {C}}\). Then

$$\begin{aligned} \left\lfloor \frac{d}{\left\lfloor \frac{m}{2}\right\rfloor } \right\rfloor \le \min \left\{ j: I\in {\mathcal {I}}({\mathbb {P}})\ \text {satisfies}\ |I^{*}|=\{l_1,\ldots ,l_j\},\ rank\{H_{l_1},\ldots ,H_{l_j}\}<\sum \limits _{i=1}^j k_{l_i}\right\} \end{aligned}$$

by Corollary 3.3. The equality holds if and only if d is divisible by \(\left\lfloor \frac{m}{2}\right\rfloor \).

Theorem 8

Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\) and \({\mathcal {C}}\subseteq {\mathbb {Z}}_m^n\) be an \((n,m^k,d)\) \(({\mathbb {P}},\pi )\)-code. Then \({\mathcal {C}}\) is an MDS \(({\mathbb {P}},\pi )\)-code if and only if \({\mathcal {C}}\) is I-perfect for some ideals \(I\in \mathcal {I}^{\left\lfloor \frac{m}{2}\right\rfloor \cdot \left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor }\) with full count.

Proof

Suppose that \({\mathcal {C}}\) is an MDS \(({\mathbb {P}},\pi )\)-code. Denote by \(r=\left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \). Then

$$\begin{aligned} n-k=\max \limits _{I\in {\mathcal {I}}({\mathbb {P}}),|I^{*}|=r}\sum \limits _{i\in I^*}k_i. \end{aligned}$$

Let I be an ideal of \({\mathbb {P}}\) with full count whose cardinality is \(r\cdot \left\lfloor \frac{m}{2}\right\rfloor \) such that \(n-k=\sum \limits _{i\in I^{*}}k_i\). Assume there exist two codewords \(c,c'\in {\mathcal {C}} \) such that the I-balls centered at c and \(c'\) have nonempty intersection. It follows from Proposition 3.1 that \(B_I(c)=B_I(c')\). Then \(c\in B_I(c')\) which implies that \(\langle supp_{(L,\pi )}(c-c')\rangle \subseteq I\). Therefore

$$\begin{aligned} d_{({\mathbb {P}},\pi )}(c,c')\le |I|=\left\lfloor \frac{m}{2}\right\rfloor \cdot \left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \le \left\lfloor \frac{m}{2}\right\rfloor \cdot \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor } =d-1, \end{aligned}$$

a contradiction. Thus, any two I-balls centered at distinct codewords of \({\mathcal {C}}\) must be disjoint. Hence, \(\bigsqcup \limits _{c\in {\mathcal {C}}}B_I(c)\) is a disjoint union and it contains \(|{\mathcal {C}}|\cdot |B_I|=m^n\) elements which implies that \({\mathcal {C}}\) is I-perfect.

Conversely, let \({\mathcal {C}}\) be an I-perfect code for some \(I\in {\mathcal {I}}^{r\cdot \lfloor \frac{m}{2}\rfloor }\) with full count. It follows from Lemma 3.1 that \(\sum \limits _{i\in I^{*}}k_i=n-k\) and hence

$$\begin{aligned} \max \limits _{I\in {\mathcal {I}}({\mathbb {P}}),|I^{*}|=r}\sum \limits _{i\in I^*}k_i=n-k \end{aligned}$$

This completes the proof. \(\square \)

Remark 3.7

An \((n,m^k,d)\) MDS \(({\mathbb {P}},\pi )\)-code \({\mathcal {C}}\) is I-perfect for all \(I\in {\mathcal {I}}^{r}({\mathbb {P}})\) with full count such that \(\sum \limits _{i\in I^{*}}k_i=n-k\) where \(r=\left\lfloor \frac{m}{2}\right\rfloor \cdot \left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \).

Since an ideal of \({\mathbb {P}}\) with partial count is always contained in an ideal of \({\mathbb {P}}\) with full count, we have the following.

Corollary 3.4

Let \({\mathcal {C}}\subseteq {\mathbb {Z}}_m^n\) be an (nKd) \(({\mathbb {P}},\pi )\)-code. Let I be an ideal of \({\mathbb {P}}\) such that \(|I^{*}|=\left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \). Then I-balls centered at the codewords of \({\mathcal {C}}\) are disjoint.

Here we give an example to show the existence of a \(({\mathbb {P}},\pi )\)-code which is MDS but not I-perfect for any \(I\in {\mathcal {I}}({\mathbb {P}})\) with partial count.

Example 3.4

Let \({\mathbb {P}}=(M,R)\) be a pomset where \(M=\{2/1,2/2\}\) and

$$\begin{aligned} R=\{(4/(2/1,2/1),4/(2/2,2/2),4/(2/2,2/1)\}. \end{aligned}$$

Let \(\pi \) be a labeling of the pomset \({\mathbb {P}}\) such that \(\pi (1)=2\) and \(\pi (2)=1\). Consider the \(({\mathbb {P}},\pi )\)-code \({\mathcal {C}}\subseteq {\mathbb {Z}}_5^3\) generated by the following matrix:

$$\begin{aligned} \left( \begin{array}{ccc} 0 &{}\quad 1 &{}\quad 3 \\ 1 &{}\quad 2 &{}\quad 0 \\ \end{array} \right) . \end{aligned}$$

Then the code \({\mathcal {C}}\) is a linear \(({\mathbb {P}},\pi )\)-code over \({\mathbb {Z}}_5\) of length 3 with \(d_{({\mathbb {P}},\pi )}(\mathcal {C})=3\). We have \(\left\lfloor \frac{d_{({\mathbb {P}},\pi )}(\mathcal {C})-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor =1\). The ideals of \({\mathbb {P}}\) such that \(|I^*|=1\) are \(I_1=\{1/2\}\) and \(I_2=\{2/2\}\) which implies that \({\mathcal {C}}\) is an MDS \(({\mathbb {P}},\pi )\)-code. The partial count ideal in \({\mathbb {P}}\) is \(I_1=\{(1/2)\}\) and \(I_2=\{1/1,2/2\}\). It is routine to verify that \(I_1\)-balls centered at the codewords of \({\mathcal {C}}\) are disjoint and the union of \(I_1\)-balls contains 75 elements. Take \(u=(0,1,3)\) and \(v=(1,2,0)\in {\mathcal {C}}\). It is easy to see that \(B_{I_2}(u)\cap B_{I_2}(v)\ne \phi \). Therefore, for any ideal I of \({\mathbb {P}}\) with partial count, the code \({\mathcal {C}}\) is not I-perfect.

If I is an ideal of \({\mathbb {P}}\) with partial count, then an I-perfect code is not necessarily an MDS code, as we can see in the next example.

Example 3.5

Let \({\mathbb {P}}=(M,R)\) be a pomset where \(M=\{3/1,3/2\}\) and

$$\begin{aligned} R=\{(9/(3/1,3/1),9/(3/2,3/2)\}. \end{aligned}$$

Let \(\pi \) be a labeling of the pomset \({\mathbb {P}}\) such that \(\pi (1)=1\) and \(\pi (2)=2\). Consider the \(({\mathbb {P}},\pi )\)-code \({\mathcal {C}}\subseteq {\mathbb {Z}}_6^3\) defined by \(\mathcal {C}=\{(0,0,0),(0,3,0),(0,0,3),(0,3,3)\}\). Consider an ideal \(I=\{3/1,1/2\}\) of \({\mathbb {P}}\) which has partial count. It is routine to verify that \({\mathcal {C}}\) is I-perfect. On the other hand, we have that \(d_{({\mathbb {P}},\pi )}({\mathcal {C}})=3\). Then \(\left\lfloor \frac{d_{({\mathbb {P}},\pi )}(\mathcal {C})-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor = 0\). Therefore \({\mathcal {C}}\) is not MDS.

Example 3.6

Let \({\mathbb {P}}=(M,R)\) be a pomset where \(M=\{3/1,3/2\}\) and

$$\begin{aligned} R=\{(9/(3/1,3/1),9/(3/2,3/2),9/(3/1,3/2)\}. \end{aligned}$$

Let \(\pi \) be a labeling of the pomset \({\mathbb {P}}\) such that \(\pi (1)=\pi (2)=1\). Consider the \(({\mathbb {P}},\pi )\)-code \(\mathcal {C}\subseteq {\mathbb {Z}}_6^2\) defined by \(\mathcal {C}=\{(0,0),(1,3)\}\). Consider \(I=\{3/1,1/2\}\) of \({\mathbb {P}}\) which has partial count. It is routine to verify that \({\mathcal {C}}\) is I-perfect. Note that \(d_{({\mathbb {P}},\pi )}({\mathcal {C}})=6\). Then \(\left\lfloor \frac{d_{({\mathbb {P}},\pi )}(\mathcal {C})-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor =1\). The ideals of \({\mathbb {P}}\) such that \(|I^*|=1\) are \(I_1=\{1/1\}\) and \(I_2=\{2/1\}\). Therefore \({\mathcal {C}}\) is an MDS \(({\mathbb {P}},\pi )\)-code.

By comparing Examples 3.5 and  3.6, we speculate that being a chain pomset may be a necessary condition for an I-perfect code to be an MDS code. We will prove this conjecture later (Theorem 11).

4 Duality and weight distribution

In this section, we consider the case for an (nKd) MDS \(({\mathbb {P}},\pi )\)-code when all the blocks have the same dimension. Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\) such that \(k_1=k_2=\cdots =k_s=t\). Then the Singleton bound becomes

$$\begin{aligned} n-\lceil \log _mK\rceil \ge t\cdot \left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor . \end{aligned}$$
(4.1)

4.1 Duality

In what follows, we characterize (nKd) MDS \(({\mathbb {P}},\pi )\)-codes when all the blocks have the same dimension.

Theorem 9

Let \({\mathbb {P}}\) be a pomset on \(M=\left\{ \left\lfloor \frac{m}{2}\right\rfloor /1,\left\lfloor \frac{m}{2}\right\rfloor /2, \ldots ,\left\lfloor \frac{m}{2}\right\rfloor /s\right\} \) and \(\widetilde{{\mathbb {P}}}\) be its dual pomset on M. Let \(\pi \) be a labeling of the pomset \({\mathbb {P}}\) with \(k_1=k_2=\cdots =k_s=t\) and \({\mathcal {C}}\) be a linear \((n,m^k,d)\) \(({\mathbb {P}},\pi )\)-code. The the following statements are equivalent:

  1. (1)

    \({\mathcal {C}}\) is an MDS \(({\mathbb {P}},\pi )\)-code;

  2. (2)

    \({\mathcal {C}}\) is an I-perfect \(({\mathbb {P}},\pi )\)-code for all \(I\in \mathcal {I}^{\frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor }({\mathbb {P}})\) with full count;

  3. (3)

    \({\mathcal {C}}^{\bot }\) is an I-perfect \((\widetilde{{\mathbb {P}}},\pi )\)-code for all \(I\in \mathcal {I}^{\frac{k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor }(\widetilde{{\mathbb {P}}})\) with full count;

  4. (4)

    \({\mathcal {C}}^{\bot }\) is an MDS \((\widetilde{{\mathbb {P}}}, \pi )\)-code;

  5. (5)

    For any ideal I with full count of \({\mathbb {P}}\) and \(x\in {\mathbb {Z}}_m^n\),

    $$\begin{aligned} |B_I(x)\cap {\mathcal {C}}|=\left\{ \begin{array}{ll} m^{tl-n+k}, &{} \text {if}\ |I|=l\cdot \lfloor \frac{m}{2}\rfloor \ge \frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor ,\\ 1, &{} \text {if}\ |I|=l\cdot \left\lfloor \frac{m}{2}\right\rfloor< \frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \ \text {and}\ x\in \bigcup \limits _{c\in {\mathcal {C}}}B_I(c),\\ 0, &{} \text {if}\ |I|=l\cdot \left\lfloor \frac{m}{2}\right\rfloor < \frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \ \text {and}\ x\notin \bigcup \limits _{c\in {\mathcal {C}}}B_I(c). \end{array} \right. \end{aligned}$$
    (4.2)

Proof

\((1)\Leftrightarrow (2)\) follows from Theorem 8, \((2)\Leftrightarrow (3)\) follows from Theorem 2 and \((3)\Leftrightarrow (4)\) follows from Theorem 8. We only need to show that (1) is equivalent to (5).

Assume that \({\mathcal {C}}\) is an MDS \(({\mathbb {P}},\pi )\)-code. Let I be an ideal of \({\mathbb {P}}\) with full count such that \(|I|=l\cdot \left\lfloor \frac{m}{2}\right\rfloor \) and \(x\in {\mathbb {Z}}_m^n\). There are two cases.

  • Case 1 Suppose that \(l\cdot \left\lfloor \frac{m}{2}\right\rfloor <\frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \). Note that no two codewords of \({\mathcal {C}}\) belong to the same I-ball. Otherwise, there exist \(c,c'\in {\mathcal {C}}\), \(c\ne c'\) such that \(c\in B_I(c')\). This implies that \(\langle supp_{(L,\pi )}(c-c')\rangle \subseteq I\) and thus

    $$\begin{aligned}{} & {} d_{({\mathbb {P}},\pi )}(c,c')=\left| \langle supp_{(L,\pi )}(c-c')\rangle \right| \\{} & {} \le \left| I\right| =l\cdot \left\lfloor \frac{m}{2}\right\rfloor < \frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor = \left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \cdot \left\lfloor \frac{m}{2}\right\rfloor \le d-1, \end{aligned}$$

    a contradiction. By Proposition 3.1, any two I-balls are either disjoint or identical and hence

    $$\begin{aligned} \left| B_I(x)\cap {\mathcal {C}}\right| =\left\{ \begin{array}{ll} 1, &{} \text {if}\ x\in \bigcup \limits _{c\in {\mathcal {C}}}B_I(c),\\ 0, &{} \text {if}\ x\notin \bigcup \limits _{c\in {\mathcal {C}}}B_I(c). \end{array} \right. \end{aligned}$$
  • Case 2 Suppose that \(l\cdot \left\lfloor \frac{m}{2}\right\rfloor \ge \frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \). Since I is full count with \(|I^{*}|=l\), there exists an ideal J of \({\mathbb {P}}\) with full count such that \(|J^{*}|=\frac{n-k}{t}\) and \(J\subseteq I\). It follows from Theorem 8 that \(\mathcal {C}\) is J-perfect. Note that \(B_J\) is a submodule of \(B_I\). The number of cosets of \(B_J\) in \(B_I\) is \(m^{lt-n+k}\). By Lemma 3.1, every \(B_J(u)\) contains exactly one element of \({\mathcal {C}}\). Therefore, \(|B_I(x)\cap {\mathcal {C}}|=m^{lt-n+k}\).

Conversely, assume that for any ideal I of \({\mathbb {P}}\) with full count and \(x\in {\mathbb {Z}}_m^n\), we have (4.2). Let \(I\in \mathcal {I}^{\frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor }({\mathbb {P}})\) be an ideal of \({\mathbb {P}}\) with full count and \(u\in {\mathbb {Z}}_m^n\). By (4.2), we have \(\left| B_I(u)\cap {\mathcal {C}}\right| =1\) which yields that \({\mathcal {C}}\) is I-perfect by Lemma 3.1. Therefore, \({\mathcal {C}}\) is I-perfect for all \(I\in \mathcal {I}^{\frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor }\) with full count. It follows from Theorem 8 that \({\mathcal {C}}\) is an MDS \(({\mathbb {P}},\pi )\)-code. \(\square \)

Example 4.1

Let \({\mathbb {P}}=(M,R)\) be a pomset where \(M=\{2/1,2/2,2/3\}\) and

$$\begin{aligned} R=\{(4/(2/1,2/1),4/(2/2,2/2),4/(2/3,2/3),4/(2/1,2/2),4/(2/3,2/2)\}. \end{aligned}$$

Let \(\pi \) be a labeling of the pomset \({\mathbb {P}}\) such that \(\pi (1)=\pi (2)=\pi (3)=2\). Consider the \(({\mathbb {P}},\pi )\)-code \({\mathcal {C}}\subseteq {\mathbb {Z}}_5^6\) generated by the following matrix:

$$\begin{aligned} \left( \begin{array}{cccccc} 0 &{}\quad 1 &{}\quad 1 &{}\quad 2 &{}\quad 2 &{}\quad 3 \\ 1 &{}\quad 0 &{}\quad 0 &{}\quad 2 &{}\quad 2 &{}\quad 3 \\ \end{array} \right) \end{aligned}$$

Then the code \({\mathcal {C}}\) is a linear \(({\mathbb {P}},\pi )\)-code over \({\mathbb {Z}}_5\) of length 6 with \(d_{({\mathbb {P}},\pi )}(\mathcal {C})=5\). We have \(\left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor =2\). The full count ideal in \({\mathbb {P}}\) such that \(|I^*|=2\) is \(I=\{2/1,2/3\}\). It follows that

$$\begin{aligned} \max \limits _{I\in {\mathcal {I}}({\mathbb {P}}),|I^*|=2}\sum \limits _{i\in I^*}k_i=4=n-k. \end{aligned}$$

Hence \({\mathcal {C}}\) is an MDS \(({\mathbb {P}},\pi )\)-code. Moreover, \({\mathcal {C}}\) is I-perfect.

Let \({\mathbb {P}}=(M,R_1)\) and \({\mathbb {Q}}=(M,R_2)\) be two pomsets on M. We say that \({\mathbb {Q}}\) is finer than \({\mathbb {P}}\) if \(p/a\ R_1\ q/b\) in \({\mathbb {P}}\) implies that \(p/a\ R_2\ q/b\) in \({\mathbb {Q}}\).

Lemma 4.1

Let \({\mathbb {P}}_1\) and \({\mathbb {P}}_2\) be two pomsets on \(M=\left\{ \left\lfloor \frac{m}{2}\right\rfloor /1,\left\lfloor \frac{m}{2}\right\rfloor /2, \ldots ,\left\lfloor \frac{m}{2}\right\rfloor /s\right\} \) and \(\pi \) be a labeling of the pomset \({\mathbb {P}}_1\) with \(k_1=k_2=\cdots =k_s=t\). If \({\mathbb {P}}_2\) is finer than \({\mathbb {P}}_1\), then every MDS \(({\mathbb {P}}_1,\pi )\)-code is an MDS \(({\mathbb {P}}_2,\pi )\)-code.

Proof

Suppose that \({\mathcal {C}}\) is an MDS (nKd) \(({\mathbb {P}}_1,\pi )\)-code. Then \(n-\lceil \log _mK\rceil =t\cdot \left\lfloor \frac{d_{({\mathbb {P}}_1,\pi )}(\mathcal {C})-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \). Since \({\mathbb {P}}_2\) is finer than \({\mathbb {P}}_1\), we have \(d_{({\mathbb {P}}_1, \pi )}(u,v)\le d_{({\mathbb {P}}_2,\pi )}(u,v)\) for any \(u,v\in {\mathbb {Z}}_m^n\). Therefore \(d_{({\mathbb {P}}_1,\pi )}({\mathcal {C}})\le d_{({\mathbb {P}}_2,\pi )}({\mathcal {C}})\) and hence

$$\begin{aligned} d_{({\mathbb {P}}_2,\pi )}({\mathcal {C}})-1\ge d_{({\mathbb {P}}_1,\pi )}(\mathcal {C})-1\ge \frac{n-\lceil \log _mK\rceil }{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor . \end{aligned}$$

This implies that \(\left\lfloor \frac{d_{({\mathbb {P}}_2,\pi )}(\mathcal {C})-1}{\left\lfloor \frac{m}{2}\right\rfloor } \right\rfloor \ge \frac{n-\lceil \log _mK\rceil }{t}\). By the Singleton bound, \({\mathcal {C}}\) is an MDS \(({\mathbb {P}}_2,\pi )\)-code. \(\square \)

Corollary 4.1

An MDS block code is also an MDS pomset block code for every pomset defined on the set of blocks when all blocks have the same dimension.

Proposition 4.1

Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\) with \(k_1=k_2=\cdots =k_s=t\) and \({\mathcal {C}}\) be an \((n,m^k,d)\) \(({\mathbb {P}},\pi )\)-code. If \({\mathcal {C}}\) is \(\big (\frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \big )\)-perfect \(({\mathbb {P}},\pi )\)-code, then \({\mathcal {C}}\) is an MDS \(({\mathbb {P}},\pi )\)-code.

Proof

By Theorem 9, it is sufficient to show that \(\mathcal {C}\) is an I-perfect code for all \(I\in \mathcal {I}^{\frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor }\) with full count. Let I be an ideal of cardinality \(\frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \) with full count. Suppose that there exist \(c,c'\in {\mathcal {C}}\), \(c\ne c'\) such that \(B_I(c)=B_I(c')\). Then \(\langle (supp_{(L,\pi )}(c-c')\rangle \subseteq I\). Since \(\mathcal {C}\) is \(\big (\frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \big )\)-perfect, the distance between two codewords of \({\mathcal {C}}\) is at least \(\frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor +1\). Then

$$\begin{aligned} \frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor +1\le d_{({\mathbb {P}},\pi )}(c,c')\le |I|=\frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor , \end{aligned}$$

a contradiction. \(\square \)

Theorem 10

Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\) with \(k_1=k_2=\cdots =k_s=t\) and \({\mathcal {C}}\) be an (nKd) \(({\mathbb {P}},\pi )\)-code. If \({\mathcal {C}}\) is I-perfect for every ideal \(I\in \mathcal {I}^{\frac{n-\lceil \log _mK\rceil }{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor }({\mathbb {P}})\), then \(\mathcal {C}\) is an MDS \(({\mathbb {P}},\pi )\)-code.

Proof

Assume that for any ideal \(I\in \mathcal {I}^{\frac{n-\lceil \log _mK\rceil }{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor }({\mathbb {P}})\), \({\mathcal {C}}\) is I-perfect. To prove \({\mathcal {C}}\) is an MDS \(({\mathbb {P}},\pi )\)-code, it is sufficient to show that \(\left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \ge \frac{n-\lceil \log _mK\rceil }{t}\). Suppose that there exist two distinct codewords \(u,v\in {\mathcal {C}}\) such that \(d_{({\mathbb {P}},\pi )}(u,v)\le \frac{n-\lceil \log _mK\rceil }{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \). Denote by \(J=\langle supp_{(L,\pi )}(u-v)\rangle \). It follows form Proposition 2.1 that there exists an ideal I with cardinality \(\frac{n-\lceil \log _mK\rceil }{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \) such that \(J\subseteq I\). Then \(u-v\in B_J\subseteq B_I\) which implies that \(u\in B_I(v)\), a contradiction to the fact that \({\mathcal {C}}\) is I-perfect. Therefore \(d>\frac{n-\lceil \log _mK\rceil }{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \) and hence \(\left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \ge \frac{n-\lceil \log _mK\rceil }{t}\). \(\square \)

4.2 Weight distribution

In what follows, we consider a \(({\mathbb {P}},\pi )\)-code \(\mathcal {C}\) whose blocks have the same dimension t and \({\mathbb {P}}\) is a chain pomset on \(M=\left\{ \left\lfloor \frac{m}{2}\right\rfloor /1,\left\lfloor \frac{m}{2}\right\rfloor /2, \ldots ,\left\lfloor \frac{m}{2}\right\rfloor /s\right\} \) such that \(\left\lfloor \frac{m}{2}\right\rfloor /1\ R\ \left\lfloor \frac{m}{2}\right\rfloor /2\ R\ \ldots R\left\lfloor \frac{m}{2}\right\rfloor /s\).

Note that every ideal I in the chain pomset \({\mathbb {P}}\) has the form \(I=\left\{ \left\lfloor \frac{m}{2}\right\rfloor /1,\left\lfloor \frac{m}{2}\right\rfloor /2, \ldots ,\left\lfloor \frac{m}{2}\right\rfloor /(i-1),p/i\right\} \) where \(1\le p\le \left\lfloor \frac{m}{2}\right\rfloor \) and p/i is the unique maximal element in I. Moreover, for any integer \(1\le r\le s\cdot \left\lfloor \frac{m}{2}\right\rfloor \), there is only one ideal I in \({\mathbb {P}}\) whose cardinality is r, that is, \(\left| {\mathcal {I}}^r({\mathbb {P}})\right| =1\) and hence \(B_r(u)=B_I(u)\) for any \(u\in {\mathbb {Z}}_m^n\).

Theorem 11

Let \(({\mathbb {P}},\pi )\) be a chain pomset block structure on \({\mathbb {Z}}_m^n\) with \(k_1=k_2=\cdots =k_s=t\). Then for any K such that \(\lceil \log _mK\rceil \) is divisible by t, every I-perfect (nKd) \(({\mathbb {P}},\pi )\)-code \({\mathcal {C}}\) is an MDS \(({\mathbb {P}},\pi )\)-code.

Proof

Let \({\mathcal {C}}\subseteq {\mathbb {Z}}_m^n\) be an I-perfect (nKd) \(({\mathbb {P}},\pi )\)-code. Then \(\bigsqcup \limits _{c\in {\mathcal {C}}}B_I(c)={\mathbb {Z}}_m^n\) and \(d>|I|\). From this, we have \(|{\mathcal {C}}|\cdot |B_I|=m^n\).

  • Case 1 If I is an ideal with full count, then \(|I^{*}|=\frac{n-\log _mK}{t}\) and \(|I|=\frac{n-\log _mK}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \). It follows from Theorem 10 that \({\mathcal {C}}\) is an MDS \(({\mathbb {P}},\pi )\)-code.

  • Case 2 If I is an ideal with partial count, then \(|I|=|J|+l\) for some ideal J with full count and \(1\le l\le \left\lfloor \frac{m}{2}\right\rfloor -1\). Since \({\mathcal {C}}\) is I-perfect, we have

    $$\begin{aligned} |{\mathcal {C}}|\cdot |B_I|=|\mathcal {C}|\cdot (2l+1)^t\cdot |B_J|=K\cdot (2l+1)^t\cdot m^{|J^*|\cdot t}=m^n, \end{aligned}$$

    yielding to

    $$\begin{aligned} \left| J^*\right| =\frac{n}{t}-\frac{\log _mK}{t}-\log _m(2l+1). \end{aligned}$$

    Since \(1\le l\le \left\lfloor \frac{m}{2}\right\rfloor -1\), we have \(0<\log _m(2l+1)<1\). Note that \(\frac{\log _mK}{t}+\log _m(2\,l+1)\in {\mathbb {Z}}\). Therefore,

    $$\begin{aligned}{} & {} \frac{\log _mK}{t}+\log _m(2l+1) \\{} & {} =\left\lfloor \frac{\log _mK}{t}+ \log _m(2l+1)\right\rfloor \le \left\lfloor \frac{\log _mK}{t}\right\rfloor + \left\lfloor \log _m(2l+1)\right\rfloor +1\\{} & {} = \bigg \lceil \frac{\log _mK}{t}\bigg \rceil . \end{aligned}$$

    Hence \(|J^*|\ge \frac{n}{t}-\bigg \lceil \frac{\log _mK}{t}\bigg \rceil \). On the other hand, \(d>|I|=|J|+l\) implies that \(\frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }>|J^{*}|+ \frac{l-1}{\left\lfloor \frac{m}{2}\right\rfloor }\). Thus,

    $$\begin{aligned} \left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \ge \left| J^*\right| \ge \frac{n}{t}-\bigg \lceil \frac{\log _mK}{t}\bigg \rceil . \end{aligned}$$

    Since \(\lceil \log _mK\rceil \) is divisible by t, we have

    $$\begin{aligned} t\cdot \left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \ge n-\bigg \lceil \log _mK\bigg \rceil . \end{aligned}$$

    By the Singleton bound, \({\mathcal {C}}\) is an MDS code.

\(\square \)

Remark 4.1

The above theorem holds for any ideal \(I\in \mathcal {I}({\mathbb {P}})\) no matter that I has full count or partial count.

Let I be an ideal of \({\mathbb {P}}\). We denote by \(I_p\) (\(I_f\) resp.) the collection of the elements in \(I^*\) which has partial count (full count resp.) in I. From the proof of Theorem 11, we obtain a corollary.

Corollary 4.2

Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\) with \(k_1=k_2=\cdots =k_s=t\). Let I be an ideal of \({\mathbb {P}}\) with partial count. Suppose that \(I_p=\{l_1,l_2,\ldots ,l_{\lambda }\}\subseteq I^{*}\) and \(1<\sum \limits _{i=1}^{\lambda }\log _m(2C_I(l_i)+1)<1\). Let \(\mathcal {C}\) be an (nKd) \(({\mathbb {P}},\pi )\)-code such that \(\lceil \log _mK\rceil \) is divisible by t and \(\left\lfloor \frac{d-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor \ge |I_f|\). If \({\mathcal {C}}\) is I-perfect, then \({\mathcal {C}}\) is MDS.

Let \(I\in {\mathcal {I}}({\mathbb {P}})\) be an ideal with partial count. Here is an example illustrates that an I-perfect \(({\mathbb {P}},\pi )\)-code is not necessarily an MDS code. But when we give some restrictions on I, an I-perfect code could be an MDS code.

Example 4.2

Let \({\mathbb {P}}=(M,R)\) be a pomset where \(M=\{4/1,4/2\}\) and

$$\begin{aligned} R=\{(16/(4/1,4/1),16/(4/2,4/2)\}. \end{aligned}$$

Let \(\pi \) be a labeling of the pomset \({\mathbb {P}}\) such that \(\pi (1)=\pi (2)=1\). Consider the \(({\mathbb {P}},\pi )\)-code \(\mathcal {C}\subseteq {\mathbb {Z}}_9^2\) defined by \(\mathcal {C}=\{(0,0),(0,3),(0,6)\}\). Then \(d_{({\mathbb {P}},\pi )}(\mathcal {C})=3\) and \(\left\lfloor \frac{d_{({\mathbb {P}},\pi )}(\mathcal {C})-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor =0\). Therefore \({\mathcal {C}}\) is not MDS. Let \(I=\{4/1,1/2\}\) be an ideal of \({\mathbb {P}}\) with partial count. It can be easily seen that \({\mathcal {C}}\) is I-perfect.

If we define \({\mathcal {C}}'=\{(0,0),(2,3),(4,6)\}\). It is routine to verify that \({\mathcal {C}}'\) is an I-perfect code. By Corollary 4.2, \({\mathcal {C}}'\) is an MDS \(({\mathbb {P}},\pi )\)-code. In fact, \(d_{({\mathbb {P}},\pi )}({\mathcal {C}}')=5\) and \(\left\lfloor \frac{d_{({\mathbb {P}},\pi )}(\mathcal {C}')-1}{\left\lfloor \frac{m}{2}\right\rfloor }\right\rfloor =1\). The ideal of \({\mathbb {P}}\) such that \(|I^*|=1\) has root set \(\{1\}\) or \(\{2\}\). It follows from \(k_1=k_2=1\) that \({\mathcal {C}}'\) is an MDS \(({\mathbb {P}},\pi )\)-code.

Furthermore, when \({\mathbb {P}}\) is chain pomset such that \(4/1\ R\ 4/2\), we can see that both \({\mathcal {C}}\) and \({\mathcal {C}}'\) are MDS \(({\mathbb {P}},\pi )\)-codes.

Denote by \(A_{r,({\mathbb {P}},\pi )}({\mathcal {C}})\) the number of codewords of \(({\mathbb {P}},\pi )\)-weight r in \({\mathcal {C}}\), that is,

$$\begin{aligned} A_{r,({\mathbb {P}},\pi )}({\mathcal {C}})=\left| \left\{ c\in {\mathcal {C}}: w_{({\mathbb {P}},\pi )}(c)=r\right\} \right| . \end{aligned}$$

Note that an ideal I of \({\mathbb {P}}\) is full count if and only if \(|I|=l\cdot \left\lfloor \frac{m}{2}\right\rfloor \).

Lemma 4.2

Let \(({\mathbb {P}},\pi )\) be a pomset block structure on \({\mathbb {Z}}_m^n\) where \({\mathbb {P}}\) is the chain pomset on \(M=\left\{ \left\lfloor \frac{m}{2}\right\rfloor /1,\left\lfloor \frac{m}{2}\right\rfloor /2, \ldots ,\left\lfloor \frac{m}{2}\right\rfloor /s\right\} \) and \(\pi \) is a labeling of the pomset \({\mathbb {P}}\) with \(k_1=k_2=\cdots =k_s=t\). Let \({\mathcal {C}}\) be an MDS linear \((n,m^k,d)\) \(({\mathbb {P}},\pi )\)-code and let \(I\in {\mathcal {I}}({\mathbb {P}})\) be an ideal of \({\mathbb {P}}\). Then

$$\begin{aligned} |B_I\cap {\mathcal {C}}|=\left\{ \begin{array}{ll} 1, &{} \text {if}\ |I|\le \frac{(n-k)}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor ,\\ m^{tl-n+k}, &{} \text {if}\ |I|=l\cdot \left\lfloor \frac{m}{2}\right\rfloor \ge \frac{(n-k)}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor ,\\ (2p+1)^tm^{tl-n+k}, &{} \text {if}\ |I|=l\cdot \left\lfloor \frac{m}{2}\right\rfloor +p> \frac{(n-k)}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor ,\ 1\le p\le \left\lfloor \frac{m}{2}\right\rfloor -1. \end{array} \right. \end{aligned}$$

Proof

Let I be an ideal with cardinality \(l\cdot \left\lfloor \frac{m}{2}\right\rfloor +p>\frac{(n-k)}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \) where \(1\le p\le \left\lfloor \frac{m}{2}\right\rfloor -1\). Then I is partial count with \(|I^{*}|=l+1\). By Proposition 2.1, there exists an ideal J with cardinality \(\frac{n-k}{t}\cdot \left\lfloor \frac{m}{2}\right\rfloor \) such that \(J\subseteq I\). It follows from Theorem 9 that \(\mathcal {C}\) is J-perfect and \(|B_J(x)\cap {\mathcal {C}}|=1\) for any \(x\in {\mathbb {Z}}_m^n\). Let \(K=I\ominus J\). The translates \(x+B_J\), \(x\in B_K\) are disjoint and their union covers \(B_I\). Therefore,

$$\begin{aligned}&|B_I\cap \mathcal {C}|\!=\!|B_K|=(2p\!+\!1)^tm^{(|I^{*}|-|J^{*}|-1)t}\\&\quad =(2p\!+\!1)^tm^{(l+1-\frac{n-k}{t}-1)t}\!=\!(2p\!+\!1)^t m^{tl\!-\!n\!+\!k}. \end{aligned}$$

This completes the proof. \(\square \)

Theorem 12

Let \(({\mathbb {P}},\pi )\) be a chain pomset block structure with \(k_1=k_2=\cdots =k_s=t\) and \({\mathcal {C}}\) be an MDS linear \((n,m^k,d)\) \(({\mathbb {P}},\pi )\)-code. Then

$$\begin{aligned} A_{r,({\mathbb {P}},\pi )}({\mathcal {C}})=\left\{ \begin{array}{ll} 1, &{} \text {if}\ r=0, \\ 0, &{} \text {if}\ 1\le r\le d-1,\\ \left( m^t-\left( 2\left\lfloor \frac{m}{2}\right\rfloor -1\right) ^t\right) m^{tl-n+k-t}, &{} \text {if}\ r=l\cdot \left\lfloor \frac{m}{2}\right\rfloor \ge d,\\ (3^t-1)m^{tl-n+k}, &{} \text {if}\ r=l\cdot \left\lfloor \frac{m}{2}\right\rfloor +1\ge d,\\ \left( (2p+1)^t-(2p-1)^t\right) m^{tl-n+k}, &{} \text {if}\ r=l\cdot \left\lfloor \frac{m}{2}\right\rfloor +p\ge d\ \text {and}\ 2\le p\le \left\lfloor \frac{m}{2}\right\rfloor -1. \end{array} \right. \end{aligned}$$

Proof

If \(r\le d-1\), then the result is trivial. So we assume that \(r\ge d\). Suppose that \({I}^r({\mathbb {P}})=\{I\}\) and \(I^{r-1}({\mathbb {P}})=\{J\}\). Then

$$\begin{aligned} A_{r,({\mathbb {P}},\pi )}({\mathcal {C}})=|B_r\cap \mathcal {C}|-|B_{r-1}\cap {\mathcal {C}}|=|B_I\cap {\mathcal {C}}|-|B_J\cap {\mathcal {C}}|. \end{aligned}$$
  • Case 1 Assume that \(r=l\cdot \left\lfloor \frac{m}{2}\right\rfloor \). Then I has full count, J has partial count and \(|I^{*}|=|J^{*}|=l\). By Lemma 4.2,

    $$\begin{aligned}{} & {} |B_I\cap {\mathcal {C}}|-|B_J\cap \mathcal {C}|=m^{tl-n+k}-\left( 2\left\lfloor \frac{m}{2}\right\rfloor -1\right) ^tm^{tl-n+k-t}\\{} & {} = m^{tl-n+k-t} \left( m^t-\left( 2\left\lfloor \frac{m}{2}\right\rfloor -1\right) ^t\right) . \end{aligned}$$
  • Case 2 Assume that \(r=l\cdot \left\lfloor \frac{m}{2}\right\rfloor +1\). Then I has partial count, J has full count and \(|J^{*}|=|I^{*}|-1=l\). By Lemma 4.2,

    $$\begin{aligned} \left| B_I\cap {\mathcal {C}}\right| -\left| B_J\cap \mathcal {C}\right| =3^tm^{tl-n+k}-m^{tl-n+k}=(3^t-1)m^{tl-n+k}. \end{aligned}$$
  • Case 3 Assume that \(r=l\cdot \left\lfloor \frac{m}{2}\right\rfloor +p\) where \(2\le p\le \left\lfloor \frac{m}{2}\right\rfloor -1\). The I and J have partial count and \(|I^{*}|=|J^{*}|=l+1\). By Lemma 4.2,

    $$\begin{aligned} |B_I\cap {\mathcal {C}}|-|B_J\cap \mathcal {C}|{} & {} =(2p+1)^tm^{tl-n+k}-(2p-1)^tm^{tl-n+k}\\{} & {} =\left( (2p+1)^t-(2p-1)^t\right) m^{tl-n+k}. \end{aligned}$$

\(\square \)

Remark 4.2

Note that when pomset block metric is defined on \({\mathbb {Z}}_2\) and \({\mathbb {Z}}_3\), pomset block and poset block weights coincide. The weight distribution of an MDS \((P,\pi )\)-code for the case when all blocks have the same dimension is determined (see [3, Theorem 5.2]). Consider two special cases of hierarchical pomset. When the hierarchical pomset is a chain pomset, Theorem 12 gives the weight distribution of an MDS \(({\mathbb {P}},\pi )\)-code for the case when all blocks have the same dimension. When the hierarchical pomset is an antichain pomset and all blocks have dimension 1, pomset block weight is the traditional Lee weight. As our best knowledge, the Lee weight distribution of an MDS code has not been obtained for general case.

Remark 4.3

When \(t=1\), Case 2 and Case 3 in Theorem 12 would coincide which is exactly Theorem 9 in [9].

5 Conclusion and further consideration

The pomset metric is a generalization of poset metric and gives rise to Lee metric if the underlying pomset is an antichain. In this paper, we introduce MDS pomset block codes and extend the concept of I-perfect codes to the case of pomset block metric.

After the introduction of pomset block codes, it would be interesting to construct Macwilliams type identities for any linear code with chain block pomset and bound for covering radius of product codes. By carefully checking relevant results on pomset codes and poset block codes, we may have a chance to explore further properties of pomset block codes.