---
abstract: 'It is well known that constructing codes with good parameters is one of the most important and fundamental problems in coding theory. Though a great many of good codes have been produced, most of them are defined over alphabets of sizes equal to prime powers. In this paper, we provide a new explicit construction of $(q+1)$-ary nonlinear codes via rational function fields, where $q$ is a prime power. Our codes are constructed by evaluations of rational functions at all the rational places (including the place of “infinity") of the rational function field. Compared to the rational algebraic geometry codes, the main difference is that we allow rational functions to be evaluated at pole places. After evaluating rational functions from a union of Riemann-Roch spaces, we obtain a family of nonlinear codes with length $q+1$ over the alphabet $\mathbb{F}_{q}\cup \{\infty\}$. As a result, our codes have reasonable parameters as they are very close to the Singleton bound. Furthermore, our codes have better parameters than those obtained from MDS codes via code alphabet restriction or extension.'
address:
- 'Shanghai Key Laboratory of Intelligent Information Processing, School of Computer Science, Fudan University, Shanghai 200433, China.'
- 'School of Mathematical Sciences, Yangzhou University, Yangzhou China 225002'
- 'School of Electronics, Information and Electric Engineering, Shanghai Jiao Tong University, China 200240'
author:
- Lingfei Jin
- Liming Ma
- Chaoping Xing
title: A new construction of nonlinear codes via rational function fields
---

Introduction
============

Since the birth of error-correcting codes, constructing codes with good parameters has become one of the most important and fundamental problems in coding theory. For a $q$-ary code of length $n$, size $M$ and minimum distance $d$, we usually denote it by an $(n,M,d)$ code. When the length $n$ is fixed, the size $M$ is a measure of the efficiency of the code and the minimum distance $d$ represents the error correcting capability. Therefore, we usually hope the size $M$ and minimum distance $d$ to be as large as possible for given $n$ and $q$. However, there are several bounds on the largest possible value of $M$. One of the well-known bounds is the so called Singleton bound which says that $M{\leqslant}q^{n-d+1}$. A linear code achieving this bound is called a maximum distance separable (MDS) code.

Many efforts have been devoted to the construction of good codes. In particular, linear codes have received great attention, such as Reed-Solomon (RS) codes, BCH codes, cyclic codes and so on, since they have good structures and many practical advantages. However, for given alphabet size $q$, length and minimum distance, the size of a nonlinear code may not be achieved by any linear codes. Indeed, there are some examples showing that linear codes do not exist for some parameters that nonlinear codes can have. For example, there are no binary linear codes of parameters $[16,8,6]$. On the other hand, the Nordstorm-Robinson code [@LX04] is a binary nonlinear code with parameters $(16,2^8,6)$. Therefore, it is also of interest to provide explicit constructions of nonlinear codes. Though a large number of nonlinear codes have been constructed, most of them are $q$-ary codes where $q$ is a prime power. The existing methods mainly consider nonlinear codes over finite fields. Less is known for constructions of $q$-ary codes, where $q$ is not a prime power, except for a very few results. Few examples, some nonlinear codes over $\ZZ_6$, $\ZZ_{10}$ or $\ZZ_{12}$ were given with certain properties [@GH05; @H00; @HM11].

In this paper, we focus on a construction of $(q+1)$-ary codes with $q$ being a prime power. To better understand the idea of this paper, here we give a high-level description of our techniques. Recall that a generalized Reed-Solomon code is constructed via evaluations of polynomials at $n$ distinct elements of $\F_q$ ($n{\leqslant}q$). Thus the length of a generalized Reed-Solomon code is upper bounded by $q$. If one includes the place of infinity, then we can obtain an extended Reed-Solomon code of length up to $q+1$. For both generalized Reed-Solomon codes and extended Reed-Solomon codes, the evaluations of polynomials still belong to $\F_q$. Hence, the codes have the alphabet size $q$. Our idea is to extend polynomials to rational functions, i.e., consider evaluations of rational functions at all the rational places of the rational function field. As a result, we produce a code of length $q+1$ over the code alphabet $\F_{q}\cup \{\infty\}$. To estimate the minimum distance, we have to control the degrees of numerator and denominator of a rational function. This constraint affects the size of the code. Thus, we have to choose suitable rational functions to make good trade-off between the minimum distance and the size of the code.

This paper is organized as follows. In Section \[sec:2\], we provide some background on the rational function field and coding theory. In Section \[sec:3\], we give an explicit construction of nonlinear codes from the rational function field. Numerical examples and comparison are given in Section \[sec:4\].

Preliminaries {#sec:2}
=============

In this section, we present some preliminaries on the theory of the rational function field, the Riemann-Roch space and coding theory.

The rational function field
---------------------------

Let us introduce some basic notations and facts of the rational function field. The reader may refer to [@St09] for more details.

Let $\F_q$ denote the finite field with $q$ elements. Denote by $F$ the rational function field $\F_q(x)$, where $x$ is a transcendental element over $\F_q$. Every finite place $P$ of $F$ corresponds to a monic irreducible polynomial $p(x)\in\F_q[x]$ and its degree is equal to the degree of corresponding polynomial. There is an infinite place of $F$ with degree one which is the unique zero of $1/x$ and denoted by $P_{\infty}$. The set of places of $F$ is denoted by $\PP_F$. The place of degree one is called rational. In fact, there are exactly $q+1$ rational places for the rational function field over $\F_q$, i.e., the place $P_{x-{\alpha}}$ for each ${\alpha}\in \F_q$ and the infinite place $P_{\infty}$. Usually, we denote $P_{x-{\alpha}}$ by $P_{{\alpha}}$ for short. Let $\Sigma$ denote the set $\F_q \cup \{\infty\}$. Then the set of all the rational places of $F$ can be identified with $\Sigma$.

Let $P$ be a rational place of $F$ and let $\mathcal{O}_P$ be the valuation ring with respect to $P$. For $f\in \mathcal{O}_P$, we define $f(P)\in \mathcal{O}_P/P=\F_q$ to be the residue class of $f$ modulo $P$; otherwise for $f\in F\setminus \mathcal{O}_P$, we define $f(P)=\infty$. In particular, if $f(x)=g(x)/h(x)\in \F_q(x)$ with relatively prime polynomials $g(x)=a_nx^n+\cdots+a_0$ and $h(x)=b_mx^m+\cdots+b_0$ with $a_n b_m\neq 0$, then the residue class map can be determined as follows $$f(P_{\alpha})=\begin{cases} g({\alpha})/h({\alpha}) & \text{ if } h({\alpha})\neq 0, \\ \infty & \text{ if } h({\alpha})=0\end{cases}$$ for any ${\alpha}\in\F_q$ and $$f(P_{\infty})=\begin{cases} a_n/b_m & \text{ if } n=m, \\ 0 & \text{ if } n<m,\\ \infty & \text{ if } n>m.\end{cases}$$

A divisor $G$ of $F$ is a formal sum $G=\sum_{P\in \PP_F} n_PP$ with only finitely many nonzero integers $n_P$. The support of $G$ is defined as the set of places with nonzero coefficients in $G$. Let $\nu_P$ be the normalized discrete valuation of $P$. For a nonzero element $f\in F$, the zero divisor of $f$ is defined by $(f)_0=\sum_{P\in \PP_F, \nu_{P}(f)>0} \nu_P(f)P,$ and the pole divisor of $f$ is defined by $(f)_\infty=\sum_{P\in \PP_F, \nu_P(f)<0} -\nu_P(f)P.$ The principal divisor of $f$ is given by $$(f)=(f)_0-(f)_\infty=\sum_{P\in \PP_F} \nu_P(f)P.$$ For two divisors $G=\sum_{P\in \PP_F} n_PP$ and $D=\sum_{P\in \PP_F} m_PP$, we define the union and intersection of $G$ and $D$ respectively as follows $$G\vee D:=\sum_{P\in\PP_F} \max\{n_P,m_P\}P,\qquad G\wedge D:=\sum_{P\in\PP_F} \min\{n_P, m_P\}P.$$ The degree of $G$ is defined by $\deg(G)=\sum_{P\in \PP_F}n_P\deg(P)$. It is clear that $$\deg(G\wedge D) +  \deg(G\vee D)= \deg(G)+\deg(D).$$

The Riemann-Roch space
----------------------

For a divisor $G$ of the rational function field $F/\F_q$, we define the Riemann-Roch space $$\mL(G):=\{u\in F^*:\; (u)+G{\geqslant}0\}\cup\{0\}.$$ From the Riemann-Roch theorem [@St09 Theorem 1.5.17], $\mL(G)$ is a vector space of dimension $\deg(G)+1$ over $\F_q$ for any divisor of nonnegative degree. For example if $G=mP_\infty$ with $m>0$, then $\mL(G)$ is an $(m+1)$-dimensional vector space of polynomials of degree at most $m$. It is straightforward to verify that $$\mL(G) \cap \mL(H) = \mL(G\wedge H) \ \makebox{and} \ \mL(G)+\mL(H) \subseteq \mL(G\vee H)$$ for any two divisors $G$ and $H$. Furthermore, the following lemmas will be very useful to determine the minimum distance of our codes constructed in the next section.

\[lem:2.1\] Let $f$ be a nonzero function in $F$ with $(f)_\infty=G$. Then for any ${\alpha}\in  \Sigma$, $f(P_{\alpha})=\infty$ if and only if $P_{\alpha}\in \supp(G)$.

It is easy to verify that $$f(P_{\alpha})=\infty \Leftrightarrow f\in F\setminus \mathcal{O}_{P_{\alpha}}   \Leftrightarrow  \nu_{P_{\alpha}}(f){\leqslant}-1  \Leftrightarrow  P_{\alpha}\in \supp(G)$$ from the definition of pole divisors.

\[lem:2.2\] Let $f$ be a nonzero function in $F$ with $(f)_\infty=G$. Then for any ${\alpha}\in  \Sigma$ with $P_{\alpha}\not\in \supp(G)$, $f(P_{\alpha})=0$ if and only if $f\in\mL(G-P_{\alpha})$.

It is easy to see that $$f(P_{\alpha})=0 \Leftrightarrow f\in P_{\alpha}\Leftrightarrow  \nu_{P_{\alpha}}(f){\geqslant}1  \Leftrightarrow  (f)+G-P_{\alpha}{\geqslant}0  \Leftrightarrow f\in\mL(G-P_{\alpha})$$ from the definition of Riemann-Roch spaces.

\[lem:2.3\] Let $f_1,f_2$ be two nonzero functions in $F$ with pole divisors $(f_i)_\infty=G_i$ for $i=1,2$. If we have $f_1(P_{\alpha})=f_2(P_{\alpha})$ for ${\alpha}\in  \Sigma$, then $f_1-f_2\in\mL(G_1+ G_2-P_{\alpha})$.

[**Case 1:** ]{} If $f_1(P_{\alpha})=f_2(P_{\alpha})\in\F_q$ for ${\alpha}\in\F_q$, then $P_{\alpha}\not\in \supp(G_1\vee G_2)$. In this case, we have $(f_1-f_2)(P_{\alpha})=f_1(P_{\alpha})-f_2(P_{\alpha})=0$. By Lemma \[lem:2.2\], we have $f_1-f_2\in\mL(G-P_{\alpha})$, where $G=(f_1-f_2)_\infty$. As $G=(f_1-f_2)_\infty{\leqslant}(f_1)_\infty+(f_2)_\infty= G_1+G_2$ from the strict triangle inequality [@St09 Lemma 1.1.11], the desired result follows.

[**Case 2:** ]{} If $f_1(P_{\alpha})=f_2(P_{\alpha})\in\F_q$ for ${\alpha}=\infty$, then $P_\infty\not\in \supp(G_1\vee G_2)$. In this case, we may assume that $f_i=g_i/h_i$ with $g_i,h_i\in\F_q[x]$, where both $h_1$ and $h_2$ are monic and $\gcd(g_i,h_i)=1$ for $i=1,2$. Since $f_i(P_\infty)\in\F_q$, the degrees of $g_i$ are less than or equal to those of $h_i$ for $i=1,2$. If $f_1(P_\infty)=f_2(P_\infty)=0$, then $P_\infty\not\in\supp(G_1\vee G_2)$ and $\deg(g_i)<\deg(h_i)$ for $i=1,2$. Thus, $f_1-f_2=\frac{g_1h_2-g_2h_1}{h_1h_2}$ with $\deg(g_1h_2-g_2h_1)<\deg(h_1h_2)$. This implies that $f_1-f_2\in\mL(G_1+ G_2-P_\infty)$.

If $f_1(P_\infty)=f_2(P_\infty)\in\F_q^*$, then the degrees of $g_i$ are equal to those of $h_i$ for $i=1,2$. Moreover, the leading coefficients of $g_1(x)$ and $g_2(x)$ are equal. As $g_1h_2$ and $g_2h_1$ have the same degrees and leading coefficients, we have $\deg(g_1h_2-g_2h_1)<\deg(g_1h_2)=\deg(h_1h_2)$. This implies that $(f_1-f_2)(P_\infty)=\frac{g_1h_2-g_2h_1}{h_1h_2}(P_\infty)=0$. By Lemma \[lem:2.2\] and Case $1$, we have $f_1-f_2\in\mL(G_1+G_2-P_\infty)$.

[**Case 3:** ]{} If $f_1(P_{\alpha})=f_2(P_{\alpha})=\infty$, then by Lemma \[lem:2.1\], we have $P_{\alpha}\in\supp(G_1)\cap\supp( G_2)$, i.e., $P_{\alpha}\in\supp(G_1\wedge G_2)$. By the identity $G_1\vee G_2=G_1+G_2-G_1\wedge G_2$, we have $G_1\vee G_2{\leqslant}G_1+G_2-P_{\alpha}$. Since $f_1-f_2$ belongs to $\mL(G_1\vee G_2)$, it follows that $f_1-f_2\in\mL(G_1+ G_2-P_{\alpha})$.

Codes
-----

We denote a $q$-ary $(n,M,d)$ code as a code of length $n$, size $M$ and minimum distance $d$. The reader may refer to [@LX04; @MS77; @St09] for more details on coding theory. There are some well-known bounds showing the restriction on the parameters of $n, M, d$ and $q$. One of the upper bound is the Singleton bound (see [[@LX04 Theorem 5.4.1]]{}).

For any integer $q>1$, any positive integer $n$ and any integer $d$ such that $1{\leqslant}d{\leqslant}n$, we have $$M{\leqslant}q^{n-d+1}.$$

A linear code achieving this bound is called a maximum distance separable (MDS) code. Let $P_1,P_2,\cdots,P_n$ be the $n$ pairwise distinct places of degree one of the rational function field $F$ and $D=\sum_{i=1}^{n}P_i$ for $n{\leqslant}q+1$. Let $G$ be a divisor of $F$ such that $0{\leqslant}\deg(G){\leqslant}n-2$ and $\text{supp}(G)\cup \text{supp}(D)=\emptyset$. Then the rational algebraic geometry code $C_{\mL}(D,G)$ defined by $$C_{\mL}(D,G):=\{(f(P_1),f(P_2),\cdots,f(P_n))|f\in \mL(G)\}$$ is an $[n, \deg(G)+1, n-\deg(G)]$ MDS code over $\F_q$ [@St09 Proposition 2.3.2].

Due to rich algebraic structures of rational function fields over finite fields, various techniques have been employed to construct good codes from rational function fields [@J15; @J16; @JK17; @JMX17; @JX15; @TB14; @X02]. In particular, we will construct $(q+1)$-ary $(n,M,d)$ nonlinear codes via rational function fields in this paper. Hence, the size of our codes is upper bounded by: $$M{\leqslant}(q+1)^{n-d+1}.$$

A new construction of nonlinear codes {#sec:3}
=====================================

Let $q$ be a prime power. Let $\F_q=\{{\alpha}_1, {\alpha}_2, \cdots, {\alpha}_q\}$ be the finite field with $q$ elements. Denote by $\Sigma$ the set $\F_q\cup \{\infty\}$. The size of $\Sigma$ is $|\Sigma|=q+1$. In this section, we will propose a construction of $(q+1)$-ary nonlinear codes over the code alphabet $\Sigma$ via the rational function field.

Our construction of codes is given explicitly as follows. Let $F/\F_q$ be the rational function field and let $m$ be a positive integer. Firstly, we choose a suitable set of rational functions which is a finite union of Riemann-Roch spaces $$\mL_m:=\bigcup_{G{\geqslant}0,\deg(G){\leqslant}m}\mL(G),$$ where $G$ runs through all the effective divisors of $F$ with degree ${\leqslant}m$. Then we consider an evaluation map $\phi: \mL_m\rightarrow \Sigma^{q+1}$ defined by $$\phi(f):=(f(P_{{\alpha}_1}), f(P_{{\alpha}_2}), \cdots, f(P_{{\alpha}_q}), f(P_{\infty}))\in \Sigma^{q+1}.$$ Our code $C_m$ is constructed as the union of the image of $\phi$ and $\{(\infty, \infty, \cdots, \infty)\}$, that is to say, $$C_m:=\{(f(P_{{\alpha}_1}), f(P_{{\alpha}_2}), \cdots, f(P_{{\alpha}_q}), f(P_{\infty})):\; f\in \mL_m\} \cup \{(\infty, \infty, \cdots, \infty)\}.$$ Our construction of nonlinear codes is different from the rational algebraic geometry codes in the sense that evaluations of rational functions are allowed at pole places as well. This technique has been employed to construct $(q+1)$-ary nonlinear codes in [@SX05; @X11]. In the following, we will show that the explicitly constructed code $C_m$ has reasonable parameters with length $n=q+1$, size $M=q^{2m+1}+q^{2m}-2q^m+2$ and minimum distance $d=q+1-2m$.

In order to determine the size of $C_m$, we need to count the exact number of different rational functions in $\mL_m$. In fact, it is a union of finitely many vector spaces over $\F_q$. Thus, it may not be a vector space over $\F_q$ anymore. However, it is not difficult to see that $\mL_m$ can be characterized as follows.

\[lem:3.1\] One has $$\mL_m=\left\{\frac{g(x)}{h(x)}:\;  g(x)\in  \F_q[x], h(x)\in \F_q[x]\setminus \{0\} \text{ with } \deg g(x){\leqslant}m, \deg h(x){\leqslant}m\right\}.$$

Now it is easy to obtain the exact number of different rational functions in $\mL_m$.

\[lem:3.2\] The cardinality of $\mL_m$ is $q^{2m+1}+q^{2m}-2q^m+1$.

Consider two subsets of $\mL_m$ defined by $$S_1=\left\{\frac{b_mx^m+\cdots+b_1x+b_0}{x^m+a_{m-1}x^{m-1}+\cdots+a_0} \in \mL_m:\; a_i, b_j\in \F_q, \text{ for } 0{\leqslant}i{\leqslant}m-1, 0{\leqslant}j{\leqslant}m\right\}$$ and $$S_2= \left\{\frac{b_mx^m+\cdots+b_1x+b_0}{h(x)}\in \mL_m:\; b_m\in \F_q^*, h(x) \text{ is monic and } \deg h(x)<m\right\}.$$ We claim that $\mL_m$ is the disjoint union of $S_1$ and $S_2$. It is easy to see that $S_1$ and $S_2$ are disjoint. It is sufficient to prove that $\mL_m\subseteq S_1\cup S_2$. For any nonzero $z\in \mL_m$, we can write $z$ in the following form $$z=\frac{g(x)}{h(x)}=\frac{b_mx^m+b_{m-1}x^{m-1}+\cdots+b_0}{a_mx^m+a_{m-1}x^{m-1}+\cdots+a_0}.$$ If $\deg g(x){\leqslant}\deg h(x)=k$, then $$z=\frac{g(x)}{h(x)}=\frac{a_k^{-1}g(x)\cdot x^{m-\deg h(x)}}{a_k^{-1}h(x)\cdot x^{m-\deg h(x)}}\in S_1.$$ If $\deg g(x)> \deg h(x)=k$, then $$z=\frac{g(x)}{h(x)}=\frac{a_k^{-1}g(x)\cdot x^{m-\deg g(x)}}{a_k^{-1}h(x)\cdot x^{m-\deg g(x)}}\in S_2.$$ Hence, $\mL_m$ is the disjoint union of $S_1$ and $S_2$. It follows that the number of distinct rational functions of $\mL_m$ is $$\begin{aligned}
|\mL_m| &=|S_1|+|S_2|\\ &= (q^{m+1}-1)\cdot q^m+1+(q-1)q^{m}\cdot (q^{m-1}+q^{m-2}+\cdots+1)\\ &=q^{2m+1}+q^{2m}-2q^m+1.\end{aligned}$$ This completes the proof.

Now we can determine the parameters of our codes $C_m$.

\[prop:3.3\] Let $q$ be a prime power and let $m$ be a positive integer with $m{\leqslant}q/2$. Then the code $C_m$ is a $(q+1)$-ary $(n,M, d)$-code with length $n=q+1$, size $M=q^{2m+1}+q^{2m}-2q^m+2$ and minimum distance $$d{\geqslant}q+1-2m.$$

The length of the code $C_m$ is clearly $q+1$. For a codeword $\bc=\phi(f)\in \Im(\phi(\mL_m))$, the number of poles of any rational function $f\in \mL_m$ is at most $m$, i.e., there are at most $m$ positions equal to $\infty$ in the codeword $\bc$. Thus, the Hamming distance between $\bc$ and $(\infty, \infty, \cdots, \infty)$ is at least $q+1-m$.

Now let $\phi(f)$ and $\phi(g)$ be two distinct codewords in $\Im(\phi(\mL_m))$ with $f\neq g\in \mL_m$. Let $w$ be the Hamming distance between $\phi(f)$ and $\phi(g)$. Then there exists a subset $S$ of $\Sigma$ of size $q+1-w$ such that $f(P_{{\alpha}})=g(P_{{\alpha}})$ for all ${\alpha}\in S$. By Lemma \[lem:2.3\], we have $0\neq f-g\in\mL\left(G_1+G_2-\sum_{{\alpha}\in S}P_{\alpha}\right)$, where $G_1=(f)_\infty$ and $G_2=(g)_\infty$. Combining $\deg(G_i){\leqslant}m$ for $i=1,2$ and $\deg\left(G_1+G_2-\sum_{{\alpha}\in S}P_{\alpha}\right){\geqslant}0$, we obtain $|S|{\leqslant}\deg(G_1)+\deg(G_2){\leqslant}2m$, i.e., $w{\geqslant}q+1-2m$. Hence, the minimum distance of $C_m$ is at least $q+1-2m$.

If $m{\leqslant}q/2$, then the minimum distance of $C_m$ is larger than $0$. Hence, the evaluation map $\phi$ is injective and the size of $C_m$ is $| \mL_m|+1=q^{2m+1}+q^{2m}-2q^m+2$. This completes the proof.

Furthermore, we can show that the minimum distance of $C_m$ is exactly equal to $q+1-2m$. Firstly, let us prove an inequality related to the size of $C_m$.

\[lem:3.4\] Let $q$ be a prime power and let $m$ be a positive integer with $m{\leqslant}q/2$. Then we have $$q^{2m+1}+q^{2m}-2q^m+2>(q+1)^{2m}.$$

If $q=2$ and $m=1$, then we have $2^3+2^2-2\cdot 2+2=10>3^{2}$. If $q{\geqslant}3$ and $2m{\leqslant}q$, then we have $$\begin{aligned}
q^{2m+1}+q^{2m}-2q^m+2 &>& 3 q^{2m} \\
&{\geqslant}& \left(1+\frac{1}{q}\right)^q \cdot q^{2m}
{\geqslant}\left(1+\frac{1}{q}\right)^{2m} \cdot q^{2m}= (q+1)^{2m}.\end{aligned}$$ The second inequality follows from the fact that the infinite sequence $$\left\{\Big{(}1+\frac{1}{k}\Big{)}^k\right\}_{k=1}^{\infty}$$ is strictly increasing and upper bounded by the natural logarithm base $e=2.718\cdots$.

Now we can show the main result of this paper.

\[thm:3.5\] Let $q$ be a prime power and let $m$ be an integer such that $m{\leqslant}q/2$. The code $C_m$ defined by $$C_m:=\{(f(P_{{\alpha}_1}), f(P_{{\alpha}_2}), \cdots, f(P_{{\alpha}_q}), f(P_{\infty})):\; f\in \mL_m\} \cup \{(\infty, \infty, \cdots, \infty)\}.$$ is a $(q+1)$-ary $(q+1, q^{2m+1}+q^{2m}-2q^m+2, q+1-2m)$ nonlinear code over $\Sigma=\F_q\cup \{\infty\}$.

Suppose that $d{\geqslant}q+2-2m$. Delete the first $d-1$ coordinates of each codeword of $C_m$. Then the remaining parts are still distinct codewords of length $n-d+1$. The maximum number of codewords of length $n-d+1$ is $(q+1)^{n-d+1}{\leqslant}(q+1)^{q+1-(q+2-2m)+1}=(q+1)^{2m}$. As we know $q^{2m+1}+q^{2m}-2q^m+2> (q+1)^{2m}$ from Lemma \[lem:3.4\], the minimum distance $d$ of $C_m$ is exactly $q+1-2m$. The remaining follows from Proposition \[prop:3.3\] immediately.

-   The code $C_m$ constructed in Theorem \[thm:3.5\] is a $(q+1)$-ary $(q+1, M)$-code with $M= q^{2m+1}+q^{2m}-2q^m+2$ achieving the largest possible minimum distance. Indeed, from the Singleton bound, every $(q+1)$-ary $(q+1, M,d)$-code must obey $M=q^{2m+1}+q^{2m}-2q^m+2{\leqslant}(q+1)^{q+2-d}$, i.e., $d{\leqslant}q+1-2m$.

-   If we consider the $(q+1)$-ary code obtained from a $q$-ary $[q+1,2m+1,q+1-2m]$ MDS code via code alphabet extension [@LX04], then we get a $(q+1)$-ary code with parameters $(q+1,q^{2m+1},q+1-2m)$. This code has parameters worse than our code in this paper. For instance, a $9$-ary $[10, 5, 6]$ MDS code gives a $10$-ary $(10,59049,6)$ code. This is worse than our $10$-ary $(10,65450,6)$ code.

-   If $q+2$ is a prime power and we consider the $(q+1)$-ary code obtained from a $(q+2)$-ary $[q+1,2m+1,q+1-2m]$ MDS code via code alphabet restriction [@LX04], then we get a $(q+1)$-ary code with parameters $(q+1,M,q+1-2m)$, where $M=\left\lceil\left(\frac{q+1}{q+2}\right)^{q+1}(q+2)^{2m+1}\right\rceil$. The parameters of the code are worse than that of our code in this paper for large $q$. For instance, a $11$-ary $[10, 5, 6]$ MDS code gives a $10$-ary $(10,61843,6)$ code. Apparently this is not as good as the $10$-ary $(10,65450,6)$ code from our construction. We will provide the details for this case in the next section.

-   If $q+1$ is a prime power, then there exists a $[q+1, 1+2m, q+1-2m]$ MDS linear code over $\F_{q+1}$ for each $1{\leqslant}m{\leqslant}q/2$ that have better parameters than the codes given in this paper. Hence, it only makes sense to consider the case where $q+1$ is not a prime power such as $q=5, 9, 11, 13$, etc.

Take $m=1,2$, we derive the following corollaries.

The code $C_1$ is a $(q+1, q^3+q^2-2q+2, q-1)$-code over $\F_q\cup \{\infty\}$.

It is easy to see that the size of $C_1$ is very close to the Singleton bound $(q+1)^3$.

For $q{\geqslant}4$, the code $C_2$ is a $(q+1, q^5+q^4-2q^2+2, q-3)$-code over $\F_q\cup \{\infty\}$.

Numerical results and comparison {#sec:4}
================================

In this section, we provide numerical examples from our construction in Section \[sec:3\] and compare our bound with other $(q+1)$-ary nonlinear codes with length $q+1$. First we list some of the nonlinear codes obtained from our construction for $q=5,9,11,13$ in the table \[table:4.1\]. One can see that our codes have good parameters.

   m       q=5               q=9                   q=11                      q=13               
  --- -------------- -------------------- ----------------------- -------------------------- -- --
   1   (6, 142, 4)       (10, 794, 8)         (12, 1432, 10)            (14, 2342, 12)          
   2   (6, 3702, 2)     (10, 65450, 6)        (12, 175452, 8)          (14, 399518, 10)         
   3                   (10, 5312954, 4)      (12, 21256072, 6)        (14, 67570934, 8)         
   4                  (10, 430454090, 2)    (12, 2572277292, 4)      (14, 11420172974, 6)       
   5                                       (12, 311248773112, 2)    (14,1930018143302, 4)       
   6                                                               (14, 326173182061118, 2)     

  : Nonlinear codes over $\F_q\cup \{\infty\}$[]{data-label="table:4.1"}

In fact, most of the codes are constructed over finite fields in the literature. It is not easy to find $(q+1)$-ary codes with length $q+1$. Luckily, Xing presented a construction of nonlinear codes over an arbitrary alphabet size from residue rings of polynomials in [@X02]. Let $q$ be a prime power such that $q+2$ is a prime. It follows from [@X02 Theorem 2.1] that there exists a $(q+1)$-ary $(q+1, M, {\geqslant}d)$-code with $$M{\geqslant}\frac{(q+1)^{q+1}}{(q+2)^{d-1}}$$ for any positive integer $d$ satisfying $0<d<q+2$. In particular, if $d=q+1-2m$, then $$\label{eq1}
M{\geqslant}\frac{(q+1)^{q+1}}{(q+2)^{q-2m}}.$$

Now we can compare our result with the bound given in [@X02].

Let $q=9$.

-   If $m=1$, then we have $q^{2m+1}+q^{2m}-2q^m+2=794$. However, [@X02] gives $$\frac{(q+1)^{q+1}}{(q+2)^{q-2m}}=\frac{10^{10}}{11^7}<514.$$

-   If $m=2$, then we have $q^{2m+1}+q^{2m}-2q^m+2=65450$. However, [@X02] gives $$\frac{(q+1)^{q+1}}{(q+2)^{q-2m}}=\frac{10^{10}}{11^5}<62093.$$

Let $q=11$.

-   If $m=1$, then we have $q^{2m+1}+q^{2m}-2q^m+2=1432$. But the bound from [@X02] shows $$\frac{(q+1)^{q+1}}{(q+2)^{q-2m}}=\frac{12^{12}}{13^9}<841.$$

-   If $m=2$, then we have $q^{2m+1}+q^{2m}-2q^m+2=175452$ But the bound from [@X02] shows $$\frac{(q+1)^{q+1}}{(q+2)^{q-2m}}=\frac{12^{12}}{13^7}<142093.$$

Let $q=27$.

-   If $m=1$, then we have $q^{2m+1}+q^{2m}-2q^m+2=20360$. But the bound (\[eq1\]) from [@X02] shows $$\frac{(q+1)^{q+1}}{(q+2)^{q-2m}}=\frac{28^{28}}{29^{25}}<9131.$$

-   If $m=2$, then we have $q^{2m+1}+q^{2m}-2q^m+2=14878892$. But the bound (\[eq1\]) from [@X02] shows $$\frac{28^{28}}{29^{23}}=\frac{(q+1)^{q+1}}{(q+2)^{q-2m}}=\frac{28^{28}}{29^{23}}<7678404.$$

-   If $m=3$, then we have $q^{2m+1}+q^{2m}-2q^m+2=10847734328$. But the bound (\[eq1\]) from [@X02] shows $$\frac{(q+1)^{q+1}}{(q+2)^{q-2m}}=\frac{28^{28}}{29^{21}}<6457537275.$$

From the above examples, we can see that our bound is better than the bound given in [@X02] when $q$ is sufficiently large compared with $m$. In particular, we can show the following result.

Assume that $m$ is fixed, then we have $$q^{2m+1}+q^{2m}-2q^m+2>\frac{(q+1)^{q+1}}{(q+2)^{q-2m}}$$ for sufficiently large $q$.

The above inequality is equivalent to $$\frac{(q+2)^{q-2m}(q^{2m+1}+q^{2m}-2q^m+2)}{(q+1)^{q+1}}>1.$$ It is easy to verify that $$\begin{aligned}
\ln \frac{(q+2)^{q-2m}(q^{2m+1}+q^{2m}-2q^m+2)}{(q+1)^{q+1}}&=&(q-2m)\ln \frac{q+2}{q+1} + \ln \frac{q^{2m+1}+q^{2m}-2q^m+2}{(q+1)^{2m+1}}\\
&\rightarrow & \frac{q-4m}{q+1},\end{aligned}$$ when $m$ is fixed and $q$ approaches to infinity. Hence, this proposition follows immediately.

[10]{}

T. Gulliver and M. Harada, [*Extremal self-dual codes over $\ZZ_6$, $\ZZ_8$ and $\ZZ_{10}$*]{}, AKCE J. Graphs. Combin., vol. 2, no. 1, pp. 11–24, 2005.

M. Harada, [*On the existence of extremal Type II codes over $\ZZ_6$*]{}, Discrete Mathematics, vol. 223, no. 1–3, pp. 373-378, Aug. 2000.

M. Harada, and T. Miezaki, [*An upper bound on the minimum weight of Type II $\ZZ_{2k}$-codes*]{}, J. Combin. Theory, Series A, vol. 118, no. 1, pp. 190–196, Jan. 2011.

L. Jin, [*A new construction of block codes from algebraic curves*]{}, IEEE Trans. Inform. Theory, vol. 61, no. 8, pp. 4239–4242, Aug. 2015.

L. Jin, [*A construction of permutation codes from rational function fields and improvement to the Gilbert–Varshamov bound*]{}, IEEE Trans. Inform. Theory, vol. 62, no. 1, pp. 159–162, Jan. 2016.

L. Jin and H. Kan, [*Construction of binary linear codes via rational function fields*]{}, Des. Codes. Cryptogr., vol. 83, no. 3, pp. 633–638, 2017.

L. Jin, L. Ma and C. Xing, [*Construction of optimal locally repairable codes via automorphism groups of rational function fields*]{}, IEEE Trans. Inform. Theory, 10.1109/TIT.2019.2946637.

L. Jin and C. Xing, [*New binary codes from rational function fields*]{}, IEEE Trans. Inform. Theory, vol. 61, no. 1, pp. 60–65, Jan. 2015.

S. Ling and C. Xing, [*Coding Theory: A First Course*]{}, Cambridge, 2004.

F. J. MacWilliams and N. J. A. Sloane, The Theory of Error-Correcting Codes, Amersterdam: North-Holland, 1977.

H. Stichtenoth, [*Algebraic Function Fields and Codes*]{} (Graduate Texts in Mathematics), vol. 254, Berlin, Germany: Springer Verlag, 2009.

H. Stichtenoth and C. Xing, [*Excellent nonlinear codes from algebraic function fields*]{}, IEEE Trans. Inform. Theory, vol. 51, no. 11, pp. 4044–4046, Nov. 2005.

I. Tamo and A. Barg, [*A family of optimal locally recoverable codes*]{}, IEEE Trans. Inform. Theory, vol. 60, no. 8, pp. 4661–4676, Aug. 2014.

C. Xing, [*Constructions of codes from residue rings of polynomials*]{}, IEEE Trans. Inform. Theory, vol. 48, no. 11, pp. 2995–2997, Nov. 2002.

C. Xing, [*Asymptotically good nonlinear codes from algebraic curves*]{}, IEEE Trans. Inform. Theory, vol. 57, no. 9, pp. 5991–5995, Sep. 2011.
