Golay Codes Sandor Swartz Electrical Engineering 459 Fall 2002 Ralf Koetter PERFECT CODES What is a perfect code? A perfect code is a code for which every vector in Hamming space (the word received through the channel) is less than half the minimum distance of the code from the nearest valid codeword. Equivalently, Hamming Spheres about every valid codeword, for some radius t, forms a mutually exclusive, collectively exhaustive set containing Hamming Space. It is thus futile to move around codewords in the coding space to try to fit another codeword in, because there is no free space to fit a codeword in. There are very few perfect codes out there. Aside from the two non-extended Golay codes, base-2 and base-3, repetition codes of odd blocklength, binary and non-binary Hamming Codes and distance-1 (trivial encoding) Hamming Space are the only “codes” that satisfy the definition of perfect codes over all finite fields. Thus, the Golay Codes are something truly exotic. It would be almost as if someone had found an exception to Fermat’s Last Theorem (before it was proven) for 3 fairly large integers and then proved the theorem for every other case. These two examples of non-trivial perfect codes are the only ones out there. Unfortunately for them, their fairly short blocklengths have duped them into non-employability for practical purposes. They are perfect by the definition of codes, but they are not perfect in every way. In what sense are they perfect? For any perfect code of finite blocklength, whether its rate is beneath or above the capacity of any channel it might be used on, has a non-zero probability of error. However, Shannon’s coding theorem guarantees the existence of codes arbitrarily close to capacity with arbitrarily small probabilities of error. Thus, the error rate of any perfect code is non-zero and constant in any given channel for which the code’s rate is beneath the channel’s capacity. Yet, for any such rate and on any such channel, some code exists with a probability of error many times smaller than that of the perfect code in question. In other words, while a “perfect” code may be “perfect” for its blocklength, it is not “perfect” in the grand scheme of things. On an AWGN channel, for instance, capacity is only approached by having codewords that themselves resemble White Gaussian Noise. Due to the great structure and limited possible values taken by the code, the discrepancy between a Golay Code, or any code taking finite possible levels, and random noise is visibly profound. They also are less than perfect in a way because they are so densely packed. Every codeword is near as many other codewords at the minimum distance as is possible. Suppose 4 errors occur. There are 253 nearby (distance 7) codewords, that these 4 errors could cause the interpretation to fall to (source 2, page 109). As a result, if a codeword is decoded incorrectly, since the nearby codewords can at very best be mapped to all (in the binary case) 12 12-bit words in which one bit is in error, 66 12-bit words in which 2 bits are in error, and 175 of the 220 12-bit words in which 3 bits are in error, one can in fact expect to make 3 or more decoded bit errors more often than 1 or 2. This does not even count the words, exactly twice as numerous, at distance 8, which can be interpreted if 5 channel errors take place instead of 4, and it does not account for the fact that if there is a linear map from the 12 bit vector to the 23 bit vector, the nearest words will not be merely one bit off or 2 but possibly anything. In other words, if you interpret the wrong block in a Golay Code, you can expect to get several errors in the decoded vector out of the 12 total, just as a result of a counting argument. You can expect to get even more than that in practice. There are 4 codes that are generally called “Golay Codes”. Their parameters are (23,12,7) 2, (11,6,5)3, (24,12,8)2 and (12,6,6)3. The first two are the original codes and the last two are quasiperfect codes that are produced by adding an even (or multiple-of-3 for the ternary code) parity check bit (or trit) at the end to give an even minimum distance, one higher, at a cost of only one in the codeword length. The first two are perfect codes, and there exist algebraic expressions for each over their respective fields. These algebraic forms represent the incredible level of structure and symmetry inherent in these codes, and also make storing and using them and most of all decoding them, a simple matter. The quasi-perfect codes will correct up to 3 or 2 errors respectively, and detect another one but not correct it. None of these codes are used particularly today, as they are simply too short. Even for error rates considerably below 3/23 for the binary or 2/11 for the ternary, errors do not tend to arrive uniformly spaced, and so very easily one or two more errors than the code can correct can arrive in a single codeword. For longer codes, this becomes statistically impossible for error rates considerably less than the number of errors the codes can correct. OK, so the White Gaussian Noise Channel and the memoryless, constant-probability binary or ternary symmetric channels or erasure channels are not what the Golay Codes could be perfect over. The question is, does there exist such a thing? Such a channel must of course have errors or there would be no justification for using the Golay Code, and there must frequently be 3 errors over every code block. There must never be more than 3 errors, and the 3 errors should be randomly distributed over the length 23 codeword or again, use of the (23,12,7) code is simply not justified. Thus, if 3 errors have already occurred, no more can be allowed until the next block starts. Unfortunately, this means such a channel must have errors that are dependent, and in some sense synchronized, with the 23 bit words as they pass through the channel. Such a channel is almost inconceivable to encounter. This is another reason why a longer code should be used for an actual application. A very easy brute-force decoding procedure exists for the Golay Codes. For any received vector in the (23,12,7)2 code, for instance, within the nearest 2048 words in Hamming Space is one and exactly one valid codeword, and that one codeword is the word that optimally should be decoded. Not only that, but the codewords are all of weight 0, 7, 8, 11, 12, 15, 16 or 23, so if only such weight codewords are considered, a brute force approach through under 2000 potential codewords to decode every length 23 block may not be unjustified (source 2). To check if a potential codeword is a codeword, simply multiply by the first row of the parity check matrix. If the result is 0, check the next row, and if 1, go to the next codeword. If the code were any longer, this may be computationally unfeasible, but the short blocklength has its advantages as well as its disadvantages. Quasi-perfect codes are codes that are, just by the name, almost perfect but not quite. By definition, for some fixed “t”, choose anything within hamming space. This vector chosen is, at most distance t+1 from a valid codeword and at least distance t. Thus this would not quite work with the brute force method given above, but the brute force method gives some insight to the implications of this definition. If one were to use t and t instead of t and t+1, the code would be perfect. With t+1, the code is very close to being perfect. The extended Golay Codes (with the parity or multiple-of-3 check bit/trit) and repetition codes of even length are examples, but unlike absolutely perfect codes, quasiperfect codes are not few and far between. They simply must be found and decoding methods found! If that is done, much of coding theory will be solved as well as possible! Of course every truly complicated problem has no simple answer. This would solve coding theory for a symmetric error channel or erasure channel, but that is all. Asymmetries can be fixed with source coding, but a deletion/insertion channel will still be way off. HISTORY The brief history of the Golay Codes begins in 1949, when M. J. E. Golay published his “Notes on Digital Coding” in the Proceedings of the Institute of Electrical and Electronic Engineers”, ½ page in length. It described the (23,12,7)2 code (although he evidently did not name it after himself). This inspired a search for more perfect codes. After all, if there was some series of perfect codes, or better yet an algorithm that produces them, much of the rest of coding theory would possibly become obsolete. For any given rate and blocklength, no code with a higher minimum distance or average minimum distance can be constructed, so if it had been determined that perfect codes existed with many rates and many blocklengths, it may have been worthwhile to only search for perfect codes. It soon appeared that such prayers fell on deaf ears, as the existence of perfect codes was disproved in more and more general scenarios. Finally, in 1973, when Aimo Tietäväinen disproved the existence of perfect codes over finite fields in his “Nonexistence of Perfect Codes over Finite Fields” in the SIAM Journal of Applied Mathematics, January 1973. The binary (23,12,7) code, the ternary (11,6,5) code, repetition codes of odd blocklength, the Hamming distance 3 codes, binary and non-binary, and Hamming Space (no encoding) are the only perfect codes over all finite fields. Thus humans know all perfect codes that exist over finite fields. However, there is no proof against the existence of almost-perfect codes, such as quasi-perfect codes. Such codes need only be found and viable decoding methods determined. Along the way, the (23,12,7)2 code inspired the Leech Lattice, a lattice array within 24 dimensional Euclidean Space in which 24-dimensional hyperspheres are unusually densely packed. It is loosely based on the Golay Code, but not exactly. For one thing, the Leech Lattice kissing number is 196560 (source 4) while there are only 4096 Golay codewords. However, the Golay Code did underlay the structured pattern of the Leech Lattice, discovered by Leech in 1965 (source 5). The Leech Lattice is more likely of future practical significance, unlike the Golay Code directly, because its complexity within Euclidean Space has the same sort of dense structure as the Golay Code, but constellation size in QCH decoders need not be as massive as the number of codewords in a good code. The Leech Lattice can be used to produce a fairly efficient set of length-24 digitally sampled, analog valued codewords for a channel such a thing may be used on. This demonstrates that while the Golay Code is not of direct practical significance any more as it has been surpassed many times over in performance by other codes, it is a mathematical structure that may be used indirectly to help solve other problems. Sources: 1) http://www.mathpuzzle.com/golay.html 2) Blahut, R. Algebraic Codes for Data Transmission, UIUC press, Feb. 2000, pages 107-9. 3) F. MacWilliams and N. Sloane, The Theory of Error-Correcting Codes, North Holland, 1977. 4) http://www.research.att.com/~njas/lattices/Leech.html 5) http://www.members.shaw.ca/quadibloc/math/pakint.htm