New bounds and constructions for constant weighted codes
Abstract
As a crucial technique for integrated circuits (IC) test response compaction, compact employs a special kind of codes called codes for reliable compressions of the test response in the presence of unknown logic values (s). From a combinatorial view point, Fujiwara and Colbourn [FC2010] introduced an equivalent definition of codes and studied codes of small weights that have good detectability and tolerance.
In this paper, bounds and constructions for constant weighted codes are investigated. First, we prove a general lower bound on the maximum number of codewords for an code of weight , and we further improve this lower bound for the case with and through the probabilistic method. Then, using tools from additive combinatorics and finite fields, we present some explicit constructions for constant weighted codes with and , which are nearly optimal for cases when and . We also consider a special class of codes introduced in [FC2010] and improve the best known lower bound on the maximum number of codewords for this kind of codes.
Keywords and phrases: circuit testing, constant weighted codes, additive combinatorics, hypergraph independent set, evenfree triple packing.
I Introduction
Typical digital circuit testing applies test patterns to the circuit and observes the circuit’s responses to the applied patterns. The observed responses are compared to a test pattern with expected responses, and a chip in the circuit is determined to be defective if the comparison mismatches. With the development of the large scale integrated circuits (IC), although the comparison for each testing output is simple, the ever increasing amount of testing data costs much more time and space for processing. This leads to the requirement of more advanced test compression techniques [MBKMPRW2003]. Since then, various related techniques have been studied such as automatic test pattern generation (ATPG) (see [LC1985, SB1988, Hollmann1990, CZ1994] and the reference therein) and compressionbased approaches (e.g., [PLR2003, MLMP2005]). The technique of compact is one of the compressionbased approaches that have high error detection ability in actual digital systems [MLMP2005].
Usually, test engineers obtain the expected responses through faultfree simulations of the circuit for the applied test patterns. But faultfree simulations cannot always determine the expected responses. In some cases, due to uninitialized memory elements, bus contention, inaccurate simulation models, etc (see Table 2 in [MLMP2005]), the responses may contain unknown logic values. These unknown bits are denoted by s, and the idea of compact provides a technique for reliable test response compaction in the presence of s [MK2004].
compact uses codes as linear maps to compress test responses. An code is an binary matrix with column vectors as its codewords. The parameters correspond to the test quality of the code. The weight of a codeword is the number of s in . The value of is called the compaction ratio and codes with large compaction ratios are desirable for actual IC testing.
For codes of arbitrary weight, let be the maximum number of codewords for which there exists an code. In [FC2010], based on a combinatorial approach, Fujiwara and Colbourn obtained a general lower bound on using probabilistic method (see Theorem 4.6, [FC2010]). And this lower bound was further improved to by Tsuboda et al. in [TFAV2018].
For constant weighted codes, let be the maximum number of codewords for which there exists an code of constant weight . Since factors like power requirements, compactor delay and wireability require the weight of each codeword to be small to meet the practical limitations (see [MLMP2005, WH2003]) and codewords with weight at most are not essential when considering the compaction ratio (see [LM2003, FC2010]). Therefore, aiming to achieve a large compaction ratio while minimizing the weight of each codeword, many works have been done about codes of constant weight .
In [WH2003], by viewing the matrix of an code as an incidence matrix of a graph, Wohl and Huisman build a connection between codes of constant weight and graphs with girth at least . For the cases with multiple ’s, using results from combinatorial design theory and superimposed codes, Fujiwara and Colbourn [FC2010] proved that and . And they studied a special class of codes of constant weight with a property that boosts test quality when there are fewer unknowable bits than anticipated. In [TF2018], Tsunoda and Fujiwara proved that for and they also improved the lower bound on the maximum number of codewords for the above special class of codes of constant weight introduced in [FC2010].
In this paper, we focus on the constant weighted codes. Based on the results from additive combinatorics and extremal graph (hypergraph) theory, we obtain the following results:

A general lower bound for constant weighted codes:

An improved lower bound for codes of constant weight with for any :
for some absolute constant .

Explicit constructions for constant weighted codes with and . These constructions further improve the general lower bound providing a nearly optimal lower bound for the case and an optimal lower bound for the case , when is large enough.

An improvement of of the best known lower bound on the maximum number of codewords for the special class of codes of constant weight introduced in [FC2010]. This improvement is also extended to the general case where higher error tolerances are required.
This paper is organised as follows: In Section II, we introduce the formal definitions for codes and superimposed codes, we also include a wellknown lower bound for hypergraph independent sets. In Section III, we investigate the bounds and constructions for constant weighted codes. We prove a general lower bound on and a nontrivial lower bound on . We also present some explicit constructions for constant weighted codes with and based on the results from additive combinatorics and finite fields. In Section IV, we improve the lower bound on the maximum number of codewords for a special class of codes of constant weight and extend this result to a general case. In Section V, we conclude our work with some remarks.
Ii Preliminaries
Iia Notation
We use the following notations throughout this paper.

Let be the power of a prime , be the finite field with elements, be the vector space of dimension over .

For any vector , let and For a set define , where for and .

For any integer , denote as the set of the first consecutive positive integers .

For simplicity, denote AP as the shortened form of arithmetic progression and AP as the shortened form of arithmetic progression of length .

For functions and , we use standard asymptotic notations , , and as :
IiB Codes
Consider two dimensional vectors and where . The addition of and is bitbybit addition, denoted by ; that is
The superimposed sum of and , denoted by , is
where if , otherwise . And we say an dimensional vector covers an dimensional vector if .
For a finite set of dimensional vectors, define
and
When , , and when , define (i.e. the zero vector).
Definition II.1.
[FC2010] Let be a positive integer and a nonnegative integer. An code is a set of dimensional vectors over such that and
(1) 
for any pair of mutually disjoint subsets and of with and . A vector is called a codeword. The weight of the code word is . The ratio is called the compaction ratio of .
Let be the maximum number of codewords for which there exists an code. From the definition above, when , the codewords of an code actually form an parity check matrix of a binary linear code of length with minimum distance . Therefore, codes can be viewed as a special kind of traditional errorcorrecting codes.
For the case when and , as pointed out in [LM2003], an code is equivalent to a superimposed code of size .
Definition II.2.
[KS1964] A superimposed code of size is an matrix with entries in such that no superimposed sum of any columns of covers any other column of .
Superimposed codes are also called coverfree families and disjunct matrices. These kinds of structures have been extensively studied in information theory, combinatorics and group testing. Thus, the bounds and constructions of superimposed codes can also be regarded as those for codes (see, for example, [BFPR1984, DR1982, EFF1982, EFF1985, Furedi1996, HS1987, SW2000]).
When and , according to the definition, an code is also an code and an code. From [LM2003], an code is an code as well.
Given an code, Fujiwara and Colbourn [FC2010] showed that a codeword of weight less than or equal to does not essentially contribute to the compaction ratio (see also [LM2003]). Therefore, when considering codes of constant weight , we always assume that .
IiC Independent sets in hypergraphs
A hypergraph is a pair , where is a finite set and is a family of subsets of . The elements of are called vertices and the subsets in are called hyperedges. We call a uniform hypergraph, if all the hyperedges have the same size , i.e., . For any vertex , we define the degree of to be the number of hyperedges containing , denoted by . The maximum of the degrees of all the vertices is called the maximum degree of and denoted by .
An independent set of a hypergraph is a set of vertices containing no hyperedges and the independence number of a hypergraph is the size of its largest independent set. There are many results on the independence number of hypergraphs obtained through different methods (see [AKPSS1982], [AKS1980], [DLR1995], [Kostochka2014]). Recall that a hypergraph is linear if every pair of distinct hyperedges from intersects in at most one vertex. In this paper, we shall use the following version of the famous result of Ajtai et al. [AKPSS1982] due to Duke et al. [DLR1995] to derive some lower bounds on .
Lemma II.3.
[DLR1995] Let and let be a uniform hypergraph with . If is linear, then
(2) 
for some constant that depends only on .
Iii Bounds and constructions of constant weighted codes
In this section, we consider codes of constant weight. This section is divided into four subsections. Section IIIA includes some known results and a general upper bound on the number of codewords of constant weighted codes. In Section IIIB, based on a result of packing, we obtain a general lower bound on the maximum number of codewords of constant weighted codes. Then in Section IIIC, we give some explicit constructions for constant weighted codes with and . And in Section III.D, we improve the general lower bound for codes of constant weight with .
Iiia A general upper bound and known results
Denote as the maximum number of codewords of an code of constant weight . Since the restrictions for codes get more rigid with the growing of , thus we have
(3) 
In 1985, Erdös et al. [EFF1985] proved the following bounds on the maximum number of codewords of a superimposed code of constant weight .
Theorem III.1.
[EFF1985] Denote as the maximum number of columns of a superimposed code of constant weight . Let . Then, we have
Moreover, if we take where , then for ,
and holds in the following cases:1) ; 2) ; 3) and . Moreover, equality of the latter upper bound holds if and only if there exists a Steiner design .
By the equivalency between an code and a superimposed code, we have the following immediate consequence:
Theorem III.2.
Let where . Then, for all ,
(4) 
And for ,
(5) 
holds in the following cases:1) ; 2) ; 3) and .
In particular, for the case , Theorem III.2 actually gives the following upper bound
(6) 
According to the results from design theory, Fujiwara and Colbourn [FC2010] proved the above upper bound is tight for the case and , when there exists a corresponding Steiner triple system. Using the wellknown graph removal lemma, Tsunoda and Fujiwara [TF2018] improved this upper bound on to for . So far as we know, for and , no upper or lower bounds better than these can be found in the literature.
IiiB A general lower bound from maximum packings
Let be an element set. A is called a packing if holds for every pair . In [R1985], Rödl proved the following lower bound on the size of the maximum packing.
Theorem III.3.
[R1985] For all positive integers , there exists a constant , such that when , we have
(7) 
Based on the above result for maximum packings, we can obtain the following asymptotic general lower bound for constant weighted codes.
Theorem III.4.
For all positive integers and , there exists a constant , such that when , we have
(8) 
Proof of Theorem iii.4.
For given and , we only need to show that the indicator vectors of a packing of size form an code of constant weight .
Consider a packing of size , fix any distinct subsets from . For each , denote as its indicator vector. Assume that there exist distinct subsets in for some , such that
Then, denote as the subset of with indicator vector , we have
for every . W.l.o.g, take . Since , we have
Therefore,
this leads to a contradiction, which indicates that is an code of constant weight . This completes the proof. ∎
IiiC Explicit constructions of constant weighted codes
IiiC1 Construction of constant weighted codes with and
In this part, based on some results from additive combinatorics, we shall prove the following asymptotic lower bound for constant weighted codes with and .
Theorem III.5.
For any and , there exists a constant , such that for , there exists an code of constant weight .
For the proof of Theorem III.5, we need the following lemma from [EFR1986].
Lemma III.6.
[EFR1986] For positive integers and , there exists a set of positive integers of size
for some absolute constant , such that contains no three terms of any arithmetic progressions of length .
The specific construction of the set from Lemma III.6 can be regarded as an extension of the APfree subset of given by Behrend [B1946]: Let and , for any , can be written as
Set , where . For , set
Proof of Theorem iii.5.
Let and be the subset constructed from Lemma III.6 such that contains no three terms of any progressions of length .
Take distinct sets , where . Define
as a family of ordered subsets in , then . Since for some , we have for every and .
Now, considering the set of indicator vectors corresponding to the subsets in , we have the following claim.
Claim 1. is an code of constant weight .
For each , denote as its indicator vector. First, noted that for any two distinct and , thus the superimposed sum of any two vectors in can not cover any other vector in .
Meanwhile, we can obtain . Therefore, when , we have . If there exist four distinct such that is covered by , one of the four intersections , , , must be strictly larger than one, which leads to a contradiction. When , if there exist distinct such that is covered by , then we have , , , , , where for , elements are pairwise distinct for some different . From the definition of , we have
where element is the leading term in , and element is the common difference corresponding to . Combining the first two identities with the one above, we have
This means that are three distinct terms in a AP, which contradicts the choice of set .
For any three distinct , we have . Therefore, when , the addition of any three distinct vectors in can not be covered by the superimposed sum of any two other vectors.
Now, assume that there exist such that is covered by .
When , we have either or . For the case , we have , , , for three pairwise distinct . For the case , we have , , , , , for five pairwise distinct . For both cases, we have three distinct s pairwise intersecting at three distinct elements s. From the analysis above, we know that this will lead to contains three distinct terms in a AP, a contradiction.
When , we have either or . For the case , we have for some and , a contradiction. For the case , we have , , and for each , where elements are pairwise distinct. From the definition of , we have
And this also leads to contains three distinct terms in a AP, a contradiction.
For the cases when and , we have . Therefore, for both cases, there exist such that for some and , a contradiction.
In conclusion, the addition of any three or fewer vectors in can not be covered by the superimposed sum of any other two vectors. Therefore, Claim 1 is verified and this completes the proof. ∎
From the analysis in the proof of Theorem III.5, when , the following simple construction can give a slightly better lower bound for constant weighted codes with and .
Let be a prime and be a power of , take distinct sets . Define
as a family of ordered subsets in , where for . For any , denote
Different from the proof of Theorem III.5, we define the indicator vector of as the concatenation of the indicator vectors of element , i.e., where is the indicator vector of element of length . Now, consider the set of indicator vectors corresponding to .
From the definition, one can easily check that for any two distinct . Therefore, the superimposed sum of the indicator vectors of any two distinct can cover at most distinct elements in for other distinct . This guarantees that the addition of any two or fewer vectors in can not be covered by the superimposed sum of any other two vectors.
When , the only case that can be covered by is when and . From the proof of Theorem III.5, this will lead to , , and for each , where elements are pairwise distinct. Since are from three distinct s, w.l.o.g., assume that and . This indicates that are covered by and . W.l.o.g., assume that , this leads to , a contradiction. Therefore, the addition of any three vectors in can not be covered by the superimposed sum of any other two vectors. This indicates that is a code of constant weight . Thus, we have
Theorem III.7.
For any and prime , let be a power of , there exists a code of constant weight .
Remark III.8.
According to the upper bound given by (6), we have
Therefore, for the case , the lower bound from Theorem III.5 is nearly optimal; and for the case , the lower bound from Theorem III.7 is optimal, regardless of a constant factor. For cases when , Theorem III.4 provides better lower bounds , but the gaps between the upper bounds and the lower bounds are still quite large.
It is also worth noting that, the construction from Theorem III.5 was originally proposed by Erdös et al. [EFR1986] to construct uniform hypergraphs on vertices such that no vertices span or more hyperedges. This kind of hypergraphs is a special kind of sparse hypergraphs which we will discuss later in Section III.D.
IiiC2 Construction of constant weighted codes with and
Before we present the construction, we shall prove a proposition which establishes a connection between constant weighted codes with and uniform hypergraphs of girth five.
Given a uniform hypergraph and a positive integer , a cycle of length in (cycle in short), denoted by , is an alternating sequence of distinct vertices and hyperedges of the form: , such that for each and . A linear path of length (path in short), denoted by , is an alternating sequence of distinct vertices and hyperedges of the form: , such that for each and whenever . And the girth of hypergraph is the minimum length of a cycle in .
Proposition III.9.
Let be a positive integer. For any uniform hypergraph of girth at least , the set of all the indicator vectors of hyperedges in forms a