Constant-weight code¶
A binary codebook whose equal-length words all contain the same fixed number of 1s, with error behavior depending on the selected words.
Core Idea¶
A binary constant-weight code is a selected set of equal-length binary words in which every word has the same number of 1 positions. If the length is n and the common weight is m, every selected word is one of the n choose m possible weight-m words. The codebook may use all of them or only a subset chosen for a desired minimum distance or practical encoding. It is the fixed-weight rule on the selected words, not a particular barcode or circuit, that identifies the abstraction.[1]
The distinction between eligible and selected words matters. A full two-of-five word space has ten possible patterns. A smaller codebook can deliberately leave patterns unused, changing which corrupted words count as another valid message. A fixed-length, one-coordinate bit flip always changes weight and leaves the weight-m space. A one-for-one exchange of an active and inactive position preserves weight, so a weight-only check misses it. The result is a different valid codeword only if it belongs to the selected codebook C; a receiver that checks membership can reject an exchanged word outside C. Fixed weight therefore supplies an available rejection test, while stronger detection depends on the actual codebook and the checks a receiver performs.[1]
Structural Signature¶
- Ordered binary positions. Every codeword uses the same
ncoordinate slots, each valued0or1. The physical carrier may be bar width, bar height, or an asserted wire, but a mapping to binary positions must be explicit.[1][2][3] - A common weight
m. Exactlympositions are1in each selected word. If valid words of different weights are mixed, this particular formal type is absent.[1] - A selected codebook
C.Cdetermines which eligible words actually carry valid symbols. It may be the complete weight-mspace or a proper subset. For a codebook with at least two words, its pairwise minimum Hamming distance is a derived diagnostic, not an additional fixed-weight admission rule.[1][3]
Recognition test. Identify the boundary of one codeword, map its physical distinctions to ordered bits, then check that every selected valid word has the same length and weight. Inspect the chosen set before claiming a particular capacity, error guarantee, or receiver operation.
What It Is Not¶
- It is not one barcode format. Matrix 2 of 5 contributes five-element digit characters with two wide elements, but the quiet zones, start/stop characters, and optional check digit frame a complete symbol outside each digit word.[2]
- It is not automatically the complete m-of-n set.
n choose mcounts all eligible words; a distance-constrained or implementation-selected code can use fewer.[1][3] - It is not a promise of all error detection. A weight-only test catches a single-coordinate flip, while a weight-preserving change needs a membership or distance test to decide whether it became another valid codeword.[1]
- It is not every delay-insensitive code. Delay-insensitive operation alone does not establish constant weight; inspect the actual selected words. Completion detection in an m-of-n rail system also depends on its communication protocol and circuitry.[3]
Scope of Application¶
The formal condition applies wherever a collection of equal-length binary representations is selected with one shared Hamming weight. Different sources can be represented and different physical features can supply 1, but the codeword boundary and binary mapping must be declared. Coding-theory constructions study how many words can be chosen at given length, weight, and minimum distance.[1]
In Matrix 2 of 5, each decimal digit character has five ordered bars-and-spaces elements, two wide and three narrow. Treating wide as 1 makes the digit character a length-five, weight-two word. The whole barcode has additional framing and may include a checksum; the source does not establish that a particular scanner validates digits by weight alone.[2]
In asynchronous interconnect, selected m-of-n codewords use asserted rails as 1 positions. The Manchester study evaluates full and incomplete rail codes, their wire costs, and completion detectors under a self-timed protocol. Its completion-detection advantage is a property of that use, not an axiom of constant-weight coding.[3] POSTNET supplies another physical realization at the digit layer: two tall and three short bars per five-bar digit.[4]
Clarity¶
The phrase “two of five” can denote a formal word constraint or one of several incompatible barcode symbologies. The formal statement specifies only length, weight, and the selected codebook. Matrix 2 of 5 adds its own element grammar, framing, and optional check digit.[2] An asynchronous two-of-five rail code can satisfy the same formal count while using different signaling and completion rules.[3] Keeping these levels separate prevents a fact about one format from being treated as a theorem about all constant-weight codes.
It also resolves a numerical ambiguity. n choose m is the number of eligible binary patterns. |C| is the number of selected codewords. They coincide only when every eligible pattern is selected. An error statement must likewise say whether a receiver checks only weight, checks membership in C, or uses a further format-level checksum.[1]
Manages Complexity¶
Matrix digit characters have five width-coded elements.[2] The Manchester rail groups use asserted wires.[3] Many implementation details can then be reduced to three invariant questions: where does a word begin and end, which physical states map to ordered binary coordinates, and which fixed-weight words are actually selected? These questions let the same formal test be applied to both carriers without pretending that their printers, scanners, handshakes, or framing formats match.
After the identity test, a second layer handles use-specific behavior: |C| and minimum distance for code design,[1] quiet zones and check digits for Matrix 2 of 5,[2] or detector and acknowledgment circuitry for asynchronous rails.[3] Collapsing those layers into a single “m-of-n benefit” would hide the assumptions that determine performance.
Abstract Reasoning¶
Given n, m, and a selected set C, first verify that every c in C has exactly m ones. Then calculate the ceiling |C| ≤ n choose m. If at least two words are selected, compare their pairwise Hamming distances to assess which corruptions can turn one selected word into another. A singleton still meets the fixed-weight condition, but its pairwise minimum distance is undefined under this convention.[1]
For a concrete countercheck, the full length-four, weight-two code includes 1100 and 1010; moving one 1 preserves weight and can turn one valid word into another. The restricted code {1100, 0011} retains weight two but rejects that particular move and has pairwise distance four. The fixed-weight identity is the same in both; the error behavior is not. This deduction follows directly from the definitions of weight, membership, and Hamming distance.[1]
Knowledge Transfer¶
The literal rule travels among coding problems whenever the new carrier can be mapped to ordered binary positions and the chosen words share one weight. A barcode digit, a postal height pattern, and an asserted-wire group can all be tested this way. What transfers is the formal membership condition and its elementary consequences, including the binomial ceiling and rejection of a single fixed-length bit flip by a correct weight check.[2][4][3]
Format and protocol conclusions do not travel automatically. Matrix 2 of 5 has quiet zones and an optional check digit.[2] The Manchester completion detector depends on its self-timed handshake.[3] Those features do not become properties of every carrier, and neither source shows that a barcode scanner counts marks. The broader idea of assigning source items to recoverable codewords may relate to Encoding and Decoding, but a formal codebook by itself does not assert that whole paired process.
Examples¶
Matrix 2 of 5 digit characters. The ordered binary positions are the five bars-and-spaces elements of one decimal digit. Mapping wide to 1 and narrow to 0 gives the common weight of two wide elements. The ten supported digits use a selected codebook of digit patterns; the technical guide does not provide a complete digit-to-pattern table in the consulted passage, so this example makes no assertion about particular assignments. A leading quiet zone, start character, optional check digit, stop character, and trailing quiet zone organize the whole symbol around those digit words.[2]
Asynchronous m-of-n rail interconnect. The ordered binary positions are n rails in a code group, with asserted rails mapped to 1. Every valid group has the common weight m; the paper evaluates full and incomplete selected codebooks, including 2-of-4 and 3-of-6 constructions. In its self-timed communication scheme, completion circuitry recognizes when a valid group has arrived. That last step maps the code into one application protocol; it is not a fourth constitutive role of the codebook.[3]
These cases change the physical carrier and surrounding apparatus while preserving the same three formal roles. POSTNET's two-tall-of-five digit convention provides a further check that width is not the only possible physical 1 feature.[4]
Structural Tensions¶
Usable size versus separation. For fixed length and weight, selecting more eligible words can carry more distinct values, but it may lower the minimum distance among selected words. A stronger distance requirement can force a smaller C; a larger C can leave more nearby valid alternatives after corruption. Neither objective is free. Diagnostic: at the specified n and m, which words were selected, how many values must be represented, and what distance remains?[1]
Wire cost versus detector complexity, in asynchronous interconnect. More complex m-of-n rail choices can reduce the wires needed for a data path, while completion detection and encoding/decoding circuits become more demanding. The Manchester study evaluates incomplete variants to manage this cost. This is a design tension of that deployment, not a reason every fixed-weight code exists. Diagnostic: what wire or throughput saving is obtained, and what completion-detector and conversion cost does that particular protocol incur?[3]
Structural–Framed Character¶
The mathematical definition uses binary vectors, common Hamming weight, and a selected codebook.[1] Matrix digit characters use bar-and-space widths,[2] while asynchronous groups use asserted rails.[3] The entry is structural within coding theory: its recognition test can be stated without a person's approval. No evaluative ranking or institution fixes the identity. Engineers and standards bodies choose practical patterns, framing, and acceptable cost, but those choices select members and uses; they do not create the common-weight rule. The vocabulary travels literally between these carriers when each feature is explicitly mapped to a bit.
Importing the named coding type into a new area requires an actual collection of equal-length binary words, not a loose analogy to “the same number of parts.” The broader possibility of faithful representation through a shared scheme belongs to the existing Encoding and Decoding Prime only when an encoder and decoder are actually present. Its character: a domain-specific formal codebook type with substrate-flexible physical instances and coding-theory-bound recognition tests.
Structural Core vs. Domain Accent¶
The broader structural pattern is selection of configurations under a fixed-cardinality constraint: choose arrangements that contain a stipulated number of active positions. Constraint captures the binding-condition part of this pattern, and Set and Membership captures the selected-collection part. Neither by itself asserts the complete binary coding identity or its error behavior.
The named entry's domain accent is indispensable. Its literal rule selects equal-length binary codewords of one Hamming weight, and its usable-size and error diagnostics depend on codebook membership and distance.[1] Matrix digit width patterns[2] and asserted-rail groups[3] instantiate that rule under explicit binary mappings. Remove those coding conditions and the name loses its recognition test; a broad fixed-cardinality analogy cannot inherit its error claims. The entry therefore remains domain-specific even though its set and constraint roles are more general.
Instantiates / Related Primes¶
This entry is part of Constraint and is a kind of Set and Membership.
Set and Membership is a strict genus. The selected codebook C is a set of identifiable words with bivalent membership. It can be counted and compared with the eligible weight-m space; pairwise distances can be studied when C contains at least two words. The order of coordinates within a codeword is essential, while the order in which codewords are listed is not. A generic set need not consist of fixed-weight binary words.
Constraint is an internal constituent. The hard rule wt(x)=m defines the eligible word space, and every member of C must satisfy it. The selected codebook may use all eligible words or only a subset. The rule belongs to the formal type; whether a barcode scanner or rail receiver checks weight is a separate implementation fact.
Encoding and Decoding becomes relevant when a use supplies a source-symbol assignment and paired encoder and decoder. A codebook alone does not run a round trip. Redundancy concerns duplicated critical components available for substitution after failure, which a fixed-weight codebook does not require.
Relationships to Other Abstractions¶
Current abstraction Constant-weight code Domain-specific
Parents (2) — more general patterns this builds on
-
Constant-weight code is a kind of Set and Membership Prime
A constant-weight codebook is a set of selected binary words with bivalent membership, specialized by equal length and one common Hamming weight.Every constant-weight codebook C is a first-class collection of distinct identifiable binary words. A candidate word either belongs to selected C or does not; C has cardinality and subset relations, and its words retain their bit-pattern identities. Reordering or repeating a listing of codewords does not change C, although coordinate order inside each word remains essential. The differentia is equal-length binary words of one stipulated Hamming weight. Generic sets need not contain binary words or obey any weight rule.
-
Constant-weight code is part of Constraint Prime
The hard equality wt(x)=m and its eligible word space are an internal, identity-bearing admissibility constituent of a constant-weight codebook.The fixed-weight rule wt(x)=m restricts length-n binary candidate words to an eligible space W_m, with the selected codebook C contained in W_m. The rule is a hard, checkable admission condition for each member of C, including when C is a proper subset or singleton. Removing it leaves an arbitrary binary codebook. This asserts an internal formal rule, not that a scanner or receiver checks weight; constraints can exist without codebooks, and the codebook is not itself a predicate.
Hierarchy paths (2) — routes to 2 parentless roots
- Constant-weight code → Set and Membership
- Constant-weight code → Constraint
Neighborhood in Abstraction Space¶
Constant-weight code sits in a sparse region of the domain-specific corpus (88th percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.
Family — Unclustered & Miscellaneous (2721 abstractions)
Nearest neighbors
- Even code — 0.82
- Locally catenative sequence — 0.81
- Gray Code — 0.80
- Repetition Code — 0.80
- Hypercube Graph — 0.79
Computed from structural-signature embeddings · 2026-10-17
Not to Be Confused With¶
- Matrix 2 of 5. This is one barcode symbology; its five-element digit characters instantiate the formal type, while the complete symbol adds framing and possibly a check digit.[2]
- An arbitrary error-correcting code. Its codewords need not share one weight. Error correction is a possible design purpose, while common weight is this entry's recognition condition.[1]
- A full m-of-n word set. It is one complete special case; a selected subset can have fewer words and different pairwise distances.[1][3]
- A delay-insensitive code in general. Unorderedness alone is insufficient to decide constant weight. Inspect the valid words, then keep handshake and completion rules at the circuit level.[3]
References¶
[1] Smith, Derek H., and Roberto Montemanni. “Some constant weight codes from primitive permutation groups”. The Electronic Journal of Combinatorics 19(4), P4 (2012), doi:10.37236/2702. Full paper consulted; §1 defines binary constant-weight codes, Hamming weight and distance, and maximum-size notation. registry ↩a ↩b ↩c ↩d ↩e ↩f ↩g ↩h ↩i ↩j ↩k ↩l ↩m ↩n ↩o ↩p ↩q
[2] Seagull Software, LLC. “Matrix 2 of 5”. Barcode Guide. Lines 37-63 identify five ordered elements per digit, two wide, framing, supported digits, and optional check digit. registry ↩a ↩b ↩c ↩d ↩e ↩f ↩g ↩h ↩i ↩j ↩k ↩l
[3] Bainbridge, W. J., W. B. Toms, D. A. Edwards, and S. B. Furber. “Delay-insensitive, point-to-point interconnect using m-of-n codes”. Proceedings of the Ninth International Symposium on Asynchronous Circuits and Systems (2003), printed pp. 230-238. Full paper consulted; §§2-8 cover self-timed grouping, full and incomplete m-of-n codes, completion detection, and implementation trade-offs. registry ↩a ↩b ↩c ↩d ↩e ↩f ↩g ↩h ↩i ↩j ↩k ↩l ↩m ↩n ↩o ↩p
[4] United States Postal Service. “Confirm Service, Product Technology, Barcoding”. Postal Bulletin 22083 (2002), lines 203-213. Documents two tall and three short bars per POSTNET digit. registry ↩a ↩b ↩c