1 Introduction

Linear complementary pairs (LCP) of codes are extensively explored because of their unique algebraic structure and wide application in cryptography. This concept was first introduced by Bhasin et al. in [1]. LCP of codes over a finite field is further studied in [5] and [6]. Hu et al. developed these codes over finite chain rings in [10]. Recently, Liu et al. [16] extended the same results over finite commutative Frobenius rings. In particular, if \(D=C^\perp \) over finite commutative Frobenius rings, LCP is reduced to LCD, studied in [2]. This paper will develop an algebraic structure of LCP of codes over finite non-commutative Frobenius rings.

On the other hand, Carlet et al. [6] showed that if the pair (CD) is LCP, where C and D are both cyclic codes over a finite field, then C and \(D^\perp \) are equivalent. They further showed that if the length of the codes is relatively prime to the characteristic of the finite field and C and D are 2D cyclic codes, then C and \(D^\perp \) are equivalent. Later, Guneri et al. [9] extended the same results for linear codes C and D, which are mD cyclic codes, where \(m\in \mathbb {N}.\)

Without any restriction on the order of the group with a characteristic of a finite field, in [4], Borello et al. established that if C and D both are group codes and the pair (CD) is an LCP of group codes, then C is permutation equivalent to \(D^\perp \). Further, Guneri et al. [8] extended those results for LCP of group codes over finite commutative chain rings. Using the same method of [8], Liu et al. established the same results for LCP of group codes over finite commutative Frobenius rings in [16]. They also established that C and \(D^\perp \) are equivalent if the pair (CD) are an LCP of group codes. In this paper, we will show that C and \(D^\perp \) are equivalent if the pair (CD) are an LCP of codes over a finite non-commutative Frobenius ring under a certain condition. The same technique will be held for LCP of codes over finite fields and an LCP of codes over finite commutative Frobenius rings

The paper is organized as follows. In Sect. 2, we recall background materials on non-commutative Frobenius rings and linear codes over a finite non-commutative ring. In Sect. 3, we study LCP codes over finite non-commutative local rings. Furthermore, we develop LCP codes over a finite non-commutative Frobenius ring in Sect. 4. Finally, we obtain if C and D are two linear codes over finite non-commutative Frobenius rings, then C is equivalent to \(D^\perp \) under certain conditions in Sect. 5.

2 Some preliminaries

In this section, we will state some basic definitions and results that are needed to derive our main results. Throughout this paper, we will assume all rings to be non-commutative unless mentioned otherwise. Now let R denote a finite ring with unity \(1_R.\) A right R-module A is said to be free if it is isomorphic to the right R-module \(R^{t}\) for some positive integer t. A right R-module P is said to be projective if there exists another right R-module Q such that \(P\oplus Q\) is a free right R-module. Further, a right R-module I is said to be injective if for any monomorphism \(g:A\rightarrow B\) of right R-modules and any R-module homomorphism \(h:A\rightarrow I\), there exists an R-module homomorphism \(h':B\rightarrow I\) such that \(h=h'\circ g\). Now, the following results are well-known.

Proposition 2.1

[7, Prop. 36] A right R-module I is injective if and only if for any right ideal, P of R, any R-module homomorphism \(f:P\rightarrow I\) can be extended to the R-module homomorphism \(f':R\rightarrow I\).

Proposition 2.2

[14, Prop. 2.5 and 3.4] Let \(P=\bigoplus \limits _{i=1}^{n} P_i\) be a direct sum of right R-modules \(P_1,P_2,\cdots ,P_n.\) The following hold.

  1. (a)

    The right R-module P is projective if and only if each \(P_i\) is a projective right R-module for \(1 \le i \le n.\)

  2. (b)

    The right R-module P is injective if and only if each \(P_i\) is an injective right R-module for \(1 \le i \le n.\)

The ring R is said to be right (resp. left) self-injective if it is injective over itself as a right (resp. left) R-module. Further, the finite ring R is said to be Frobenius if it is right and left self-injective. Equivalently, the finite ring R is said to be Frobenius if the right R-module \(\dfrac{R}{J(R)}\) is isomorphic to \(\textit{Soc}(R)\) as a right R-module, where \(\texttt {J}(R)\) denotes the Jacobson radical of R (i.e., the intersection of all maximal ideals of R) and Soc(R) denotes the Socle of R (i.e., the sum of all irreducible ideals of R). For more details, see [14]. Note that \(\texttt {J}(R)\) is a 2-sided ideal of R.

Proposition 2.3

[14, Th. 15.9] The following two statements are equivalent:

  1. (a)

    The ring R is Frobenius.

  2. (b)

    Every right ideal of R is a projective right R-module if and only if it is an injective right R-module.

A non-empty subset C of \(R^n\) is called a linear code of length n over R if it is a right R-submodule of \(R^n\). We define the inner product on \(R^n,\) as follows

$$[x,y]=\sum _{i=1}^nx_iy_i,$$

where \(x=(x_1,x_2,\dots ,x_n)\) and \(y=(y_1,y_2,\dots ,y_n)\) in \(R^n.\) For a linear code C (right R-submodule of \(R^n\)), the orthogonal set of C is defined by

$$C^\perp =\{v\in R^n~|~[v,c]=0~\forall ~c\in C\}.$$

Note that if C be a linear code (right R-submodule of \(R^n\)) then \(C^\perp \) is a left R-submodule of \(R^n\). It is well known that \(|C||C^\perp |=|R^n|\) (see [20]).

For a right R-submodule C of \(R^n,\) the left annihilator of C is defined by

$$\texttt {Ann}_{l}(C)=\{x\in R^n~|~[x, c]=0~\forall ~c\in C\}.$$

Note that \(\texttt {Ann}_{l}(C)\) is a left R-submodule of \(R^n.\) The following proposition, we found in [14, 20].

Proposition 2.4

Let C be a right R-submodule of \(R^n\). Assume the left annihilator of C is \(\texttt {Ann}_{l}(C).\) Then \(|C||\texttt {Ann}_{l}(C)|=|R^n|.\)

Let M be a right R-submodule of \(R^n\) and I be a 2-sided ideal of R. Recall that

$$MI=\{\sum _{\text {finite~sum}}mr~|~m\in M,~r\in I\}.$$

We give a proposition as follows.

Proposition 2.5

[11, Th. 13.11] Let M be a finitely generated right R-module. If \(M\texttt {J}(R)=M,\) then \(M=0.\)

We deduced the following proposition using Proposition 2.5 and Theorem V.5 in [18].

Proposition 2.6

Let R be a local\(~^{*}\) ring. Let \(t_1,t_2,\dots ,t_k\in M,\) where M is a right R-module.

  1. (a)

    \(t_1,t_2,\dots ,t_k\) generates M as a right R-module if and only if \(\bar{t_1},\bar{t_2},\dots ,\bar{t_k}\) generate \(M/M\texttt {J}(R)\) as an \(\mathbb {F}_q\)-vector space.

  2. (b)

    \(t_1,t_2,\dots ,t_k\) forms a minimal set of generators M as a right R-module if and only if \(\bar{t_1},\bar{t_2},\dots ,\bar{t_k}\) generate \(M/M\texttt {J}(R)\) as an \(\mathbb {F}_q\)-vector space.

\(^{*}\) Reader can see Sect. 3 about local rings.

3 Characterization of LCP of codes over a finite non-commutative Frobenius local ring

In this section, let R be a finite non-commutative Frobenius local ring. According to Theorem V.1 in[18], R is a local ring if and only if the non-units of R form an additive Abelian group. We denote the Jacobson radical of R is \(\texttt {J}(R)\) consists of all non-unit elements of R,  as R is an Artinian local ring. According to Wedderburn’s little theorem, every skew field is commutative. Hence, we will denote \(\mathbb {F}_q=R/\texttt {J}(R)\) as the residue field of R. There is a natural surjective homomorphism from R onto \(\mathbb {F}_q,\) i.e., \(\pi ~:~R\rightarrow R/\texttt {J}(R),\) \(r\mapsto r+\texttt {J}(R),\) for any r in R. This \(\pi \) can be extended naturally to a homomorphism from \(R^n\) to \(\mathbb {F}_q^n.\) It is clear that this map is a surjective ring homomorphism. It is obvious that \(\pi \) maps a linear code over R to linear code over \(\mathbb {F}_q.\) We deployed the preliminaries and existing results in Sect. 2. Let us note that linear code over R is a right R-submodule of \(R^n.\) On the other hand, since R is a finite ring, then there exists \(t\in \mathbb {N}\) such that \(\texttt {J}(R)^{t+1}=\texttt {J}(R)^{t}.\) By the Proposition 2.5, we obtain that \(\texttt {J}(R)^{t}=\{0\}.\) This implies that \(\texttt {J}(R)\) is nilpotent with nilpotency index t (i.e., \(\texttt {J}(R)^{t}=\{0\}\) but \(\texttt {J}(R)^{t-1}\ne \{0\}.\)) Note that \(\texttt {J}(R)\) is a both sided ideal of R and satisfying the following condition

$$0=\texttt {J}(R)^{t}\subseteq \texttt {J}(R)^{t-1}\subseteq \dots \subseteq \texttt {J}(R)\subseteq R.$$

Using this relation, we make the following lemma.

Lemma 3.1

Let R be a finite non-commutative local ring with Jacobson radical \(\texttt {J}(R).\) Then there exists \(m\in \texttt {J}(R)\) such that \(\alpha m=0,\) for all \(\alpha \in \texttt {J}(R).\)

Proof

By the previous discussion, we obtain that \(\texttt {J}(R)^t=0\) but \(\texttt {J}(R)^{t-1}\ne 0\) and \(\texttt {J}(R)^{t-1}\subseteq \texttt {J}(R).\) Thus there exists \(m(\ne 0)\in \texttt {J}(R)^{t-1}\) such that \(\alpha m=0,\) for all \(\alpha \in \texttt {J}(R).\) \(\square \)

Definition 3.2

For any positive integer n,  an \(n\times n\) matrix \(\textrm{A}\) is called invertible over R if \(\pi (\textrm{A})\) is invertible over \(\mathbb {F}_q,\) where \(\pi (\textrm{A})=(\pi (a_{ij}))\) for all \(1\le i,j \le n.\)

Lemma 3.3

Let C and D be two linear codes over R. Then \(C\cap D=\{0\}\) if and only if \(\pi (C)\cap \pi (D)=\{0\}.\)

Proof

Let us suppose that \(\pi (C)\cap \pi (D)=\{0\}.\) We shall prove that \(C\cap D=\{0\}.\) Let \(x\in C\cap D,\) which implies \(x\in C\) and \(x\in D,\) this force that \(\pi (x)\in \pi (C)\cap \pi (D).\) By the hypothesis, \(\pi (x)=0,\) which means \(x\in (C\cap D)\texttt {J}(R).\) Hence, \(C\cap D =(C\cap D)\texttt {J}(R).\) Since \(C\cap D\) is finitely generated right R-module, then by Proposition 2.5, we obtain that \(C\cap D=\{0\}.\)

For the reverse part, let us assume that \(C\cap D=\{0\}.\) Let \(x\in \pi (C)\cap \pi (D),\) which means \(x\in \pi (C)\) and \(x\in \pi (D).\) then there exists \(c\in C\) and \(d\in D\) such that \(x=\pi (c)=\pi (d).\) This follows that \(c-d\in R^n\texttt {J}(R).\) Now by the Lemma 3.1, there exist non-zero \(m\in \texttt {J}(R)\) such that \((c-d)m=0,\) which implies \(cm=dm\in C\cap D.\) By hypothesis \(cm=dm=0.\) Thus, \(c\in R^n\texttt {J}(R).\) Otherwise, \(c\in R^n\setminus R^n\texttt {J}(R).\) This means that \(cm (\ne 0) \in C\cap D,\) which contradicts the fact that \(C\cap D=\{0\}.\) Therefore, \(\pi (C)\cap \pi (D)=\{0\}.\) \(\square \)

Theorem 3.4

Let C and D be two linear codes over R. If the pair (CD) is LCP. Then the pair \((\pi (C), \pi (D))\) is LCP.

Proof

Since the pair (CD) is an LCP code. i.e., \(C+D=R^n\) and \(C\cap D=\{0\}.\) By the Lemma 3.3, we obtain that \(\pi (C)\cap \pi (D)=\{0\}.\) Since, \(\pi \) is surjective, for each \(x\in \mathbb {F}_q^n,\) there exists \(a\in R^n\) such that \(x=\pi (a).\) Also, \(a=c+d,\) for some \(c\in C\) and \(d\in D.\) Thus \(x=\pi (c)+\pi (d)\in \pi (C)+\pi (D).\) Since \(\pi (C)+\pi (D)\) is a subspace of \(\mathbb {F}_q^n,\) then, \(\pi (C)+\pi (D)=\mathbb {F}_q^n.\) Thus, the pair \((\pi (C), \pi (D))\) is an LCP. \(\square \)

Towards this, naturally, one question arrives in our mind: What condition of LCP of codes exists? Now, we will find the answer to our question as follows. Now, we found a lemma, which is as follows:

Lemma 3.5

[12, Theorem 2] Any projective module over a local ring (not necessarily commutative) is free right R-module.

Lemma 3.6

Let C and D be two linear codes over R. If the pair (CD) is an LCP of codes in \(R^n,\) then C and D both are free right R-module.

Proof

Since the pair (CD) forms an LCP of codes, that means \(C\oplus D=R^n\) it follows that \(C\oplus D\) is free right R-module. This implies that C and D both are projective right R-module. As R is local, then by Lemma 3.5, C and D both are free right R-module. \(\square \)

If we consider C and D to be both free right R-module, the pair (CD) may or may not be LCP of codes in general. For this, we illustrate an example as follows

Example 1

Let R be the collection of \(2\times 2\) matrices, and the element is of the form as follows.

$$\left( {\begin{array}{cccc} a &{} x \\ 0 &{} a \\ \end{array} } \right) ,$$

where \(a,x\in \mathbb {F}_q.\) The Jacobson radical of R consists of matrices of the form

$$\left( {\begin{array}{cccc} 0 &{} x \\ 0 &{} 0 \\ \end{array} } \right) ,$$

where \(x\in \mathbb {F}_q.\) One can check that \(R/\texttt {J}(R)\simeq \mathbb {F}_q\) under the mapping \(\left( {\begin{array}{cccc} a &{} x \\ 0 &{} a \\ \end{array} } \right) \mapsto a.\) Hence, R is a non-commutative local ring. Let C and D be two linear codes over R of length 4. The generator matrices of C and D are \(G_1=\left( {\begin{array}{cccc} {\textbf {1}} &{} {\textbf {0}} &{} {\textbf {1}} &{} {\textbf {0}} \\ {\textbf {0}} &{} {\textbf {1}} &{} {\textbf {0}} &{} {\textbf {1}} \\ \end{array} } \right) \) and \(G_1=\left( {\begin{array}{cccc} {\textbf {1}} &{} {\textbf {1}} &{} {\textbf {1}} &{} {\textbf {1}} \\ {\textbf {0}} &{} {\textbf {1}} &{} {\textbf {1}} &{} {\textbf {1}} \\ \end{array} } \right) ,\) where \({\textbf {1}}=\left( {\begin{array}{cccc} 1 &{} 0 \\ 0 &{} 1 \\ \end{array} } \right) \) is unit in R. It is easy to see that \(C+D=R^n\) but \(C\cap D\ne \{0\}\) as \(({\textbf {1}},{\textbf {1}},{\textbf {1}},{\textbf {1}})\in C\cap D\). However, C and D are free.

Theorem 3.7

Let C and D be two free linear codes over R. Then the pair (CD) is LCP if and only if the pair \((\pi (C), \pi (D))\) is LCP.

Proof

From Theorem 3.4, follows that if the pair (CD) is LCP, then the pair \((\pi (C), \pi (D))\) is LCP.

For the converse part, let us suppose that the pair \((\pi (C), \pi (D))\) is LCP, that means \(\pi (C)\oplus \pi (D)=\mathbb {F}_q^n,\) i.e., \(\pi (C)+\pi (D)=\mathbb {F}_q^n\) and \(\pi (C)\cap \pi (D)=\{0\}.\) Now by the Lemma 3.3, we obtain that \(C\cap D=\{0\}.\) Let \(\{\pi (x_1),\pi (x_2),\dots ,\pi (x_k)\}\) be a basis of \(\pi (C)\) and \(\{\pi (x_{k+1}),\pi (x_{k+2}),\dots ,\pi (x_n)\}\) be a basis of \(\pi (D).\) By Proposition 2.6, we have \(\{x_1,x_2,\dots ,x_k\}\) is a minimal generating set of C and \(\{x_{k+1},x_{k+2},\dots ,x_{n}\}\) is a minimal generating set of D. By hypothesis, C and D both are free, so we get that \(|C||D|=|R^n|.\) Thus, the pair (CD) is LCP. \(\square \)

Note that if C is a linear code over R,  with generator matrix \(\textrm{G}\) and parity check matrix \(\textrm{H}\) then by Proposition 2.6, we have \(\pi (\textrm{G})\) and \(\pi (\textrm{H})\) is a generator and parity check matrix of \(\pi (C),\) respectively. Now, we made a proposition, which is found in [3]

Proposition 3.8

[3, Corollary 4] Let C and D are free codes over finite commutative Frobenius ring R with generator matrices \(\textrm{G}_1,\) \(\textrm{G}_2\) and parity check matrices \(\textrm{H}_1,\) \(\textrm{H}_2,\) respectively, with the condition \(|C||D|=|R^n|.\) Then the following statements are equivalent

  1. (1)

    the pair \((\pi (C),\pi (D))\) is an LCP codes in \(\mathbb {F}_q^n\);

  2. (2)

    \(\pi (\textrm{H}_2)\pi (\textrm{G}_1)^\top \) is invertible or \(\pi (\textrm{H}_1)\pi (\textrm{G}_2)^\top \) is invertible;

  3. (3)

    \(\left( {\begin{array}{ccc} \pi (\textrm{G}_1) \\ \pi (\textrm{G}_2) \\ \end{array} } \right) \) is invertible over \(\mathbb {F}_q\);

  4. (4)

    \(\left( {\begin{array}{ccc} \pi (\textrm{H}_1) \\ \pi (\textrm{H}_2) \\ \end{array} } \right) \) is invertible over \(\mathbb {F}_q.\)

Theorem 3.9

Let C and D be two free linear codes in \(R^n\) with generator matrices \(\textrm{G}_1,\) \(\textrm{G}_2\) and parity check matrix \(\textrm{H}_1,\) \(\textrm{H}_2\) respectively, with the condition \(|C||D|=|R^n|.\) Then the pair (CD) is LCP if and only if \(\textrm{H}_2\textrm{G}_1^\top \) or \(\textrm{H}_1\textrm{G}_2^\top \) are invertible.

Proof

Suppose the pair (CD) is an LCP of codes, i.e., \(C\cap D=\{0\}\) and \(C+D=R^n.\) If possible let \(\textrm{H}_2\textrm{G}_1^\top \) is not invertible over R. From Definition 3.2, \(\pi (\textrm{H}_2\textrm{G}_1^\top )\) is not invertible over \(\mathbb {F}_q.\) Since, \(\pi \) is a ring homomorphism, which implies \(\pi (\textrm{H}_2\textrm{G}_1^\top )=\pi (\textrm{H}_2) \pi (\textrm{G}_1)^\top .\) Using the Proposition 3.8, we obtain that \((\pi (C),\pi (D))\) can not be an LCP of codes. Therefore, by the Theorem 3.7, we get that (CD) can not be an LCP of codes, which is a contradiction. Thus, \(\textrm{H}_2\textrm{G}_1^\top \) or \(\textrm{H}_1\textrm{G}_2^\top \) are invertible.

Conversely, let us assume that \(\textrm{H}_2\textrm{G}_1^\top \) or \(\textrm{H}_1\textrm{G}_2^\top \) are invertible. By the Definition 3.2, \(\pi (\textrm{H}_2\textrm{G}_1^\top )\) is invertible over \(\mathbb {F}_q.\) Since, \(\pi \) is a ring homomorphism, which implies \(\pi (\textrm{H}_2\textrm{G}_1^\top )=\pi (\textrm{H}_2) \pi (\textrm{G}_1)^\top .\) This implies that \((\pi (C), \pi (D))\) is LCP by using Proposition 3.8. By the Theorem 3.7, we obtain that the pair (CD) forms an LCP of codes over R. \(\square \)

Theorem 3.10

Let C and D be two free linear codes in \(R^n\) with generator matrices \(\textrm{G}_1,\) \(\textrm{G}_2\) and parity check matrix \(\textrm{H}_1,\) \(\textrm{H}_2\) respectively, with the condition \(|C||D|=|R^n|.\) Then the following are equivalent

  1. (1)

    the pair (CD) form LCP;

  2. (2)

    \(\left( {\begin{array}{ccc} \textrm{G}_1 \\ \textrm{G}_2 \\ \end{array} } \right) \) is invertible over R;

  3. (3)

    \(\left( {\begin{array}{ccc} \textrm{H}_1 \\ \textrm{H}_2 \\ \end{array} } \right) \) is invertible over R.

Proof

We shall prove this theorem in the following sequence (1) implies (2),  (2) implies (1) and (1) implies (3),  (3) implies (1). We only need to show that (1) implies (2) and vice-versa. The reader can prove another consequence similarly.

For the proof, (1) implies (2),  let us suppose that the pair (CD) forms LCP. If possible, let us suppose that \(\left( {\begin{array}{ccc} \textrm{G}_1 \\ \textrm{G}_2 \\ \end{array} } \right) \) is not invertible over R. From Definition 3.2, \(\pi \left( {\begin{array}{ccc} \textrm{G}_1 \\ \textrm{G}_2 \\ \end{array} } \right) \) is not invertible over \(\mathbb {F}_q.\) Since, \(\pi \) is a ring homomorphism, which implies \(\pi \left( {\begin{array}{ccc} \textrm{G}_1 \\ \textrm{G}_2 \\ \end{array} } \right) =\left( {\begin{array}{ccc} \pi (\textrm{G}_1) \\ \pi (\textrm{G}_2) \\ \end{array} } \right) .\) Then the matrix \(\left( {\begin{array}{ccc} \pi (\textrm{G}_1) \\ \pi (\textrm{G}_2) \\ \end{array} } \right) \) is not invertible over \(\mathbb {F}_q.\) Hence the pair \((\pi (C),\pi (D))\) can not be an LCD, follows from Proposition 3.8. This contradict to the fact the Theorem 3.7.

For the proof of (2) implies (1),  let us suppose that \(\left( {\begin{array}{ccc} \textrm{G}_1 \\ \textrm{G}_2 \\ \end{array} } \right) \) is invertible over R. From Definition 3.2, \(\pi \left( {\begin{array}{ccc} \textrm{G}_1 \\ \textrm{G}_2 \\ \end{array} } \right) \) is invertible over \(\mathbb {F}_q.\) Since, \(\pi \) is a ring homomorphism, which implies \(\pi \left( {\begin{array}{ccc} \textrm{G}_1 \\ \textrm{G}_2 \\ \end{array} } \right) =\left( {\begin{array}{ccc} \pi (\textrm{G}_1) \\ \pi (\textrm{G}_2) \\ \end{array} } \right) .\) Then the matrix \(\left( {\begin{array}{ccc} \pi (\textrm{G}_1) \\ \pi (\textrm{G}_2) \\ \end{array} } \right) \) is invertible over \(\mathbb {F}_q.\) Hence the pair \((\pi (C),\pi (D))\) forms an LCD, follows from Proposition 3.8. Therefore, by the Theorem 3.7, the pair (CD) is an LCP. \(\square \)

4 LCP codes over a finite non-commutative Frobenius ring

In this section, we used the symbol R as a finite non-commutative Frobenius ring. For the codes C and D, the pair (CD) is called LCP if \(C\oplus D=R^n.\) This gives that C and D both are projective right R-module. Towards this, C and D are injective right R-module, it follows from Proposition 2.3. Consequently, if a pair (CD) is LCP, then C and D both are injective right R-module. If C and D both are injective right R-module, the pair (CD) may or may not be LCP. Readers can find an easy example. But, we claim that if injective hull of \(C\oplus D\) is \(R^n,\) then the pair (CD) forms LCP. We will answer this question later. Now we will introduce an example of LCP codes (CD) over R. Note that both the code C and D are non-free right R-submodule of \(R^n.\)

Example 2

Let \(\mathbb {F}_q\) be a finite field with q elements. Let R be the 4-dimensional \(\mathbb {F}_q\)-ring consisting of matrices of the form

$$\left( {\begin{array}{cccc} a &{} x &{} 0 &{} 0\\ 0 &{} a &{} 0 &{} 0\\ 0 &{} 0 &{} b &{} y\\ 0 &{} 0 &{} 0 &{} b\\ \end{array} } \right) ,$$

where \(a,b,x,y\in \mathbb {F}_q.\) The Jacobson radical of R is the collection of matrices of the form

$$\left( {\begin{array}{cccc} 0 &{} x &{} 0 &{} 0\\ 0 &{} 0 &{} 0 &{} 0\\ 0 &{} 0 &{} 0 &{} y\\ 0 &{} 0 &{} 0 &{} 0\\ \end{array} } \right) .$$

Reader can check that \(R/\texttt {J}(R)\simeq \mathbb {F}_q \times \mathbb {F}_q,\) under the mapping \(\left( {\begin{array}{cccc} a &{} x &{} 0 &{} 0\\ 0 &{} a &{} 0 &{} 0\\ 0 &{} 0 &{} b &{} y\\ 0 &{} 0 &{} 0 &{} b\\ \end{array} } \right) \mapsto (a,b).\) Therefore, R is a finite non-commutative Frobenius ring. Let us consider \(e_1, e_2\in R\) such that \(e_1R\) and \(e_2R\) forms a linear codes over R,  where \(e_1=\left( {\begin{array}{cccc} 1 &{} 0 &{} 0 &{} 0\\ 0 &{} 1 &{} 0 &{} 0\\ 0 &{} 0 &{} 0 &{} 0\\ 0 &{} 0 &{} 0 &{} 0\\ \end{array} } \right) \) and \(e_2=\left( {\begin{array}{cccc} 0 &{} 0 &{} 0 &{} 0\\ 0 &{} 0 &{} 0 &{} 0\\ 0 &{} 0 &{} 1 &{} 0\\ 0 &{} 0 &{} 0 &{} 1\\ \end{array} } \right) .\) Let us choose \(C=e_1R\) and \(D=e_2R.\) Since \(e_1\) and \(e_2\) both are idempotent and \(e_1+e_2={\textbf {1}},\) where \({\textbf {1}}=\left( {\begin{array}{cccc} 1 &{} 0 &{} 0 &{} 0\\ 0 &{} 1 &{} 0 &{} 0\\ 0 &{} 0 &{} 1 &{} 0\\ 0 &{} 0 &{} 0 &{} 1\\ \end{array} } \right) \) is identity in R. Thus, \(C\oplus D=R.\) Hence the pair (CD) forms an LCP. But neither C nor D are free. Otherwise, \(C=R,\) which is absurd.

In Example 2, we have seen that non-free LCP codes exist over finite Frobenius rings. Now, we will characterize LCP codes over finite non-commutative Frobenius rings using advanced module theory.

Definition 4.1

Let C be a right R-submodule of \(R^n.\) C is said to be an essential submodule of \(R^n\) if for every non-zero right R-submodule M of \(R^n\) such that \(C\cap M\ne 0.\)

Lemma 4.2

Let C and D be two linear codes in \(R^n.\) If the pair (CD) is an LCP, then \(C\oplus D\) is essential submodule of \(R^n.\)

Proof

Since, the pair (CD) forms an LCP, i.e., \(C\oplus D=R^n.\) It means if there exists a right R-sbmodule M of \(R^n\) such that \((C\oplus D)\cap M=\{0\},\) which implies \(M=0.\) Thus, \(C\oplus D\) is essential submodule of \(R^n.\) \(\square \)

For reader convenience, we will find converse of the above lemme later. Before, we will recall some preliminary that have an important role in finding the answer.

Definition 4.3

Let C be a right R-submodule of \(R^n.\) A right R-submodule I is said to be an injective hull of C if I is injective module and C is an essential submodule of I. We denote injective hull of C as \(E(C)=I\)

Theorem 4.4

Let C and D be two linear codes in \(R^n.\) Then the pair (CD) is LCP if and only if C and D both are injective with \(E(C\oplus D)=R^n.\)

Proof

Let us suppose that the pair (CD) is an LCP, i.e., \(C\oplus D=R^n.\) Therefore, C and D are injective. By the Lemma 4.2, \(C\oplus D\) is essential submodule of \(R^n,\) thus \(E(C\oplus D)=R^n.\)

Conversely, let us suppose that C and D both are injective with \(E(C\oplus D)=R^n.\) i.e., \(E(C)=C\) and \(E(D)=D\) also \(C\oplus D=E(C)\oplus E(D)=E(C\oplus D)=R^n.\) Thus, (CD) forms LCP. \(\square \)

Definition 4.5

Let C and D be two right R-submodule of \(R^n.\) D is said to be a complement submodule of C in \(R^n\) if D is a right R-submodule of \(R^n\) maximal with respect to \(C\cap D=\{0\}.\)

By the routine application of Zorn’s lemma, we see that for a given right R-submodule C of \(R^n\) there always exists a maximal submodule D of \(R^n\) such that \(C\cap D=\{0\}.\) Consequently, \(C\oplus D\) is a right R-submodule of \(R^n.\)

Lemma 4.6

Let C and D be two linear codes in \(R^n.\) If the pair (CD) is an LCP, then C is a complement submodule of D in \(R^n\) and D is a complement submodule of C in \(R^n.\)

Proof

Since, the pair (CD) forms an LCP, i.e., \(C\oplus D=R^n.\) It means \(C+D=R^n\) and \(C\cap D=\{0\}.\) This shows that C is a complement submodule of D in \(R^n\) and D is a complement submodule of C in \(R^n.\) \(\square \)

Note that for a right R-submodule C of \(R^n\) is essential submodule of \(R^n\) if and only if 0 is a maximal submodule of \(R^n.\)

Definition 4.7

Let C be a right R-submodule of \(R^n.\) C is said to be a closed in \(R^n\) if C is the complement of some submodule of \(R^n.\)

A right R-submodule of \(R^n\) is closed, provided C has no proper essential submodule in \(R^n.\) Moreover, if D is any right R-submodule of \(R^n,\) then there exists, by Zorn’s Lemma, a submodule K of \(R^n\) maximal with respect to the property that D is an essential submodule of C and in this case, C is a closed submodule of \(R^n.\)

Lemma 4.8

Let C be a right R-submodule of \(R^n.\) If C is essential submodule of \(R^n\) and closed submodule of \(R^n.\) Then \(C=R^n.\)

Proof

Since C is an essential submodule of \(R^n,\) then for every non-zero right R-submodule of \(R^n\) such that \(C\cap M\ne \{0\}.\) Again, C is closed then there exist some right R-submodule N such that N is a complement of C. This force that \(C=R^n.\) \(\square \)

Lemma 4.9

Let C and D be two linear codes in \(R^n.\) If the pair (CD) is an LCP, then C and D both are closed submodule of \(R^n.\)

Proof

Since, the pair (CD) forms an LCP, i.e., \(C\oplus D=R^n.\) It means \(|C||D|=|R^n|\) and \(C\cap D=\{0\}.\) Thus, C is a complement of D and D is also complement of C. This shows that C and D both are closed submodule of \(R^n.\) \(\square \)

Theorem 4.10

Let C and D be two linear codes in \(R^n.\) Then the pair (CD) is LCP if and only if D is complement of C such that \(C\oplus D\) is closed.

Proof

Let us suppose that the pair (CD) is LCP. Therefore, \(C\cap D=R^n.\) and \(C\cap D=\{0\}.\) Then by the Lemma 4.6, D is complement of C. Since \(C\oplus D=R^n,\) it follows that \(C\oplus D\) is a complement of \(\{0\}.\) From Definition 4.7, we get \(C\oplus D\) is closed.

Conversely, let us assume that D is a complement of C such that \(C\oplus D\) is closed. We shall show that \(C\oplus D\) is an essential submodule of \(R^n.\) Let M be a non-zero right R-submodule of \(R^n.\) We have to see that \((C\oplus D)\cap M\ne \{0\}.\) This is clear if \(M\subseteq D.\) Otherwise, the maximality condition of D that \(C\cap (D+M)\ne \{0\},\) which implies there exists a non-zero \(x\in C\cap (D+M),\) this gives that \(x=d+m,\) where \(d\in D\) and \(m\in M.\) Hence \(m(\ne 0)\in (C\oplus D)\cap M,\) as \(C\cap D=\{0\}.\) By the hypothesis, \(C\oplus D\) is a closed. From the Lemma 4.8, we have \(C\oplus D=R^n.\) This gives that the pair (CD) forms an LCP codes over R. \(\square \)

Theorem 4.11

Let C and D be two linear codes in \(R^n\) such that \(C\oplus D\) is closed. Then the following are equivalent

  1. (1)

    the pair (CD) is LCP;

  2. (2)

    \(C\oplus D\) is an essential submodule of \(R^n\);

  3. (3)

    0 is a complement of \(C\oplus D.\)

Proof

\((1)\Rightarrow (2)\) It follows from Lemma 4.2.

\((2)\Rightarrow (1)\) By the hypothesis, \(C\oplus D\) is closed and \(C\oplus D\) is an essential submodule of \(R^n,\) thus, by Lemma 4.8, (CD) forms an LCD code.

\((2)\Leftrightarrow (3)\) It is trivial. \(\square \)

Theorem 4.12

Let C and D be two linear codes in \(R^n\) such that \(|C||D|=|R^n|.\) Then the following are equivalent

  1. (1)

    the pair (CD) is LCP;

  2. (2)

    \(C\oplus D\) is an essential submodule of \(R^n\);

  3. (3)

    0 is a complement of \(C\oplus D\);

  4. (4)

    D is complement of C;

  5. (5)

    \(C\oplus D\) is closed.

Proof

\((1)\Rightarrow (2)\) It follows from Lemma 4.2.

\((2)\Rightarrow (1)\) By the hypothesis, \(|C||D|=|R^n|\) and \(C\oplus D\) is a submodule of \(R^n,\) thus (CD) forms an LCD code.

\((2)\Leftrightarrow (3)\) It is trivial.

\((1)\Rightarrow (4)\) It is follows from Lemma 4.6.

\((4)\Rightarrow (2)\) Let N be a non-zero right R-submodule of \(R^n.\) We have to see that \((C\oplus D)\cap N\ne \{0\}.\) This is clear if \(N\subseteq D.\) Otherwise, the maximality condition of D that \(C\cap (D+N)\ne \{0\},\) which implies there exists a non-zero \(x\in C\cap (D+N),\) this gives that \(x=d+y,\) where \(d\in D\) and \(y\in N.\) Hence \(y(\ne 0)\in (C\oplus D)\cap N,\) as \(C\cap D=\{0\}.\)

\((1)\Rightarrow (5)\) Since (CD) is LCP, i.e., \(C\oplus D=R^n.\) It gives that \(C\oplus D\) is a complement of \(\{0\}\) in \(R^n.\) By Definition 4.7, \(C\oplus D\) is close submodule of \(R^n.\)

\((5)\Rightarrow (1)\) It is trivial. \(\square \)

Remark 4.13

Let C and D be two linear codes over a finite non-commutative ring R. If the pair (CD) satisfies the Theorem 4.12, then (CD) forms a non-free LCP codes. For example:

Example 3

In Example 2, \(C=e_1R\) and \(D=e_2R\) both are non-free linear codes over R. One can check that the pair (CD) satisfies the all condition of Theorem 4.12. Hence (CD) is an example of non-free LCP codes over R.

5 Equivalent codes

In this section, our main aim is to find conditions for a pair of LCP codes (CD) such that \(D^\perp \) is equivalent to C. We denote R as a finite non-commutative Frobenius ring. Since R is finite, any right R-submodule of \(R^n\) is finitely generated. Let us suppose that \(\{\alpha _1,\alpha _2,\dots ,\alpha _k\}\) be a minimal generating set of C. Let \(\textrm{G}\) be a generator matrix of C and G is of the form

$$\textrm{G}=\left( {\begin{array}{cccccc} \alpha _1\\ \alpha _2\\ \vdots \\ \alpha _k\\ \end{array} } \right) =\left( {\begin{array}{cccc} \alpha _{11} &{} \alpha _{12} &{} \cdots &{} \alpha _{1n}\\ \alpha _{21} &{} \alpha _{22} &{} \cdots &{} \alpha _{2n}\\ \vdots &{} \vdots &{} \ddots &{}\vdots \\ \alpha _{k1} &{} \alpha _{k2} &{} \cdots &{} \alpha _{kn}\\ \end{array} } \right) .$$

Thus, G is an \(k\times n\) matrix, where \(k\le n.\) Any linear code C is a right R-submodule of \(R^n,\) with generator matrix \(\textrm{G}.\) Then C can be written as follows

$$C=\{\textrm{G}^\top \alpha ^\top ~|~\alpha \in R^k\}.$$

Now we consider e such that

$$e=\left( {\begin{array}{cccc} \alpha _{11} &{} \alpha _{12} &{} \cdots &{} \alpha _{1n}\\ \alpha _{21} &{} \alpha _{22} &{} \cdots &{} \alpha _{2n}\\ \vdots &{} \vdots &{} \ddots &{}\vdots \\ \alpha _{k1} &{} \alpha _{k2} &{} \cdots &{} \alpha _{kn}\\ 0 &{} 0 &{} \cdots &{} 0\\ \vdots &{} \vdots &{} \ddots &{}\vdots \\ 0 &{} 0 &{} \cdots &{} 0\\ \end{array} } \right) .$$

Now, C can be rewritten as follows

$$C=\{\textrm{G}^\top \alpha ^\top ~|~\alpha \in R^k\}=\{e^\top \alpha ^\top ~|~\alpha \in R^n\}.$$

Lemma 5.1

If \(C=\{e^\top \alpha ^\top ~|~\alpha \in R^n\}\) is a linear code over R,  then the dual code of C is

$$C^\perp =\texttt {Ann}_{l}(C).$$

Moreover, \(C^\perp \) is a left R-submodule of \(R^n.\)

Proof

C is a right R-submodule of \(R^n.\) Now, definition of \(\texttt {Ann}_{l}(C)=\{x\in R^n~|~[x,c]=0~\forall ~c\in C\},\) follows that \(\texttt {Ann}_{l}(C)\subseteq C^\perp .\) From the Proposition 2.4, we get

$$|C^\perp |=\dfrac{|R^n|}{|C|}=|\texttt {Ann}_{l}(C)|.$$

Hence, \(C^\perp =\texttt {Ann}_{l}(C).\) \(\square \)

Lemma 5.2

If \(e^2=e\in M_n(R)\) and \(C=\{e^\top \alpha ^\top ~|~\alpha \in R^n\},\) then \(C^\perp =\{\beta ({\textbf {1}}-e^\top )~|~\beta \in R^n\}.\)

Proof

By the Lemma 5.1, we have \(C^\perp =\{\beta ({\textbf {1}}-e^\top )~|~\beta \in R^n\},\) as \(e^2=e\in M_n(R).\) \(\square \)

Theorem 5.3

Let C and D be two linear codes over R such that the pair (CD) forms an LCP. If there exists an idempotent element \(e\in M_n(R)\) such that \(C=\{e^\top \alpha ^\top ~|~\alpha \in R^n\}\) and D is equivalent to \(\{({\textbf {1}}-e)\beta ^\top ~|~\beta \in R^n\}.\) Then \(C^\perp \) is equivalent to D. Moreover, \(D^\perp \) is equivalent to C.

Proof

Since e is idempotent element in \(M_n(R),\) and \(C=\{(e^\top \beta ^\top ~|~\beta \in R^n\},\) then by Lemma 5.2, \(C^\perp =\{\delta ({\textbf {1}}- e^\top )~|~\delta \in R^n\}.\) Since \((\alpha e)^\top =e^\top \alpha ^\top .\) Thus, \(C^\perp \) is equivalent to D. \(\square \)

Remark 5.4

In Theorem 5, we see that if C and D are two linear code over finite non-commutative Frobenius ring R such that \(C=\{e^\top \alpha ^\top ~|~\alpha \in R^n\}\) and \(D=\{({\textbf {1}}-e)\beta ^\top ~|~\beta \in R^n\},\) where \(e^2=e.\) Then \(C^\perp \) is equivalent to D. If we replace a finite non-commutative Frobenius ring with a finite commutative Frobenius ring. The proof is similar. Moreover, Theorem 5 is applicable for R is a finite field and also for a finite chain ring or finite local ring.

Example 4

Let C and D be two linear code over R (Define in Example 1) and \(q=3\) of length 3 with generator matrices

$$\textrm{G}=\left( {\begin{array}{cccc} {\textbf {1}} &{} {\textbf {2}} &{} {\textbf {0}} \\ {\textbf {0}} &{} {\textbf {1}} &{} {\textbf {2}} \\ \end{array} } \right) ,~~~~~\textrm{G}_2=\left( {\begin{array}{cccc} {\textbf {1}} &{} {\textbf {2}} &{} {\textbf {1}} \\ \end{array} } \right) ,$$

respectively, where \({\textbf {1}}=\left( {\begin{array}{cccc} 1 &{} 0 \\ 0 &{} 1 \\ \end{array} } \right) \in R\) and \({\textbf {2}}=\left( {\begin{array}{cccc} 2 &{} 0 \\ 0 &{} 2 \\ \end{array} } \right) \in R\). It is easy to see that \(C\oplus D=R^n.\) Let us consider

$$e=\left( {\begin{array}{cccc} {\textbf {1}} &{} {\textbf {0}} &{} {\textbf {2}}\\ {\textbf {0}} &{} {\textbf {1}} &{} {\textbf {2}}\\ {\textbf {0}} &{} {\textbf {0}} &{} {\textbf {0}}\\ \end{array} } \right) $$

such that \(e^2=e\in M_3(R)\) and \(C=\{e^\top \alpha ^\top ~|~\alpha \in R^n\}\) and D is equivalent to \(\{(1-e)\beta ^\top ~|~\beta \in R^n\}.\) By the Theorem 5, we obtain \(C^\perp \) is equivalent to D. Moreover, \(D^\perp \) is equivalent to C.

Example 5

Let C and D be two linear code over R (Define in Example 2) and \(q=3\) of length 4 with generator matrices

$$\textrm{G}_1=\left( {\begin{array}{cccc} {\textbf {1}} &{} {\textbf {0}} &{} {\textbf {1}} &{} {\textbf {1}} \\ {\textbf {0}} &{} {\textbf {1}} &{} {\textbf {1}} &{} {\textbf {1}} \\ \end{array} } \right) ,~~~~~\textrm{G}_2=\left( {\begin{array}{cccc} {\textbf {1}} &{} {\textbf {1}} &{} {\textbf {1}} &{} {\textbf {0}}\\ {\textbf {1}} &{} {\textbf {1}} &{} {\textbf {0}} &{} {\textbf {1}}\\ \end{array} } \right) ,$$

respectively. It is easy to see that \(C\oplus D=R^n.\) Let us consider

$$e=\left( {\begin{array}{cccc} {\textbf {1}} &{} {\textbf {0}} &{} {\textbf {1}} &{} {\textbf {1}}\\ {\textbf {0}} &{} {\textbf {1}} &{} {\textbf {1}} &{} {\textbf {1}}\\ {\textbf {0}} &{} {\textbf {0}} &{} {\textbf {0}} &{} {\textbf {0}}\\ {\textbf {0}} &{} {\textbf {0}} &{} {\textbf {0}} &{} {\textbf {0}}\\ \end{array} } \right) $$

such that \(e^2=e\in M_4(R)\) and \(C=\{e^\top \alpha ^\top ~|~\alpha \in R^n\}\) and D is equivalent to \(\{({\textbf {1}}-e)\beta ^\top ~|~\beta \in R^n\}.\) By the Theorem 5, we obtain \(C^\perp \) is equivalent to D. This gives \(d(C^\perp )=d(D)\) Moreover, \(D^\perp \) is equivalent to C. i.e., \(d(D^\perp )=d(C).\)