Information Compression vs. General-Purpose Encoding: The Starting Point Is a Single Distinction
This article explains why every information system begins with one binary distinction, and breaks that idea into three claims: sufficiency, content-freeness, and primacy. It shows how equal-probability selection leads to log2(n) bits, how entropy sets the exact lower bound for non-uniform sources, why the two sides of a distinction need no inherent meaning, and how hysteresis keeps binary decisions stable under noise. It also maps the three claims to engineering practice, clarifies what they do not promise, and offers a practical checklist with Python examples for measuring and diagnosing encoding schemes.
1. The Problem: Why Every Information System Starts With a Binary Choice
Before discussing compression ratios, transmission bandwidth, or storage cost, ask a more fundamental question: what is the minimum a system needs in order to “express any content”? The answer is not some complex structure, but a stable binary state that can be reliably distinguished. As long as there exists a device with two stable states, and we stipulate that “each operation must and can only fall into one of them,” we already have the smallest unit for representing information.
This article breaks that fact into three claims and verifies each one for whether it is “enough”:
- Claim 1 (Sufficiency): Any content can be written as a sequence of binary choices, each falling on one of two sides; no material beyond “distinction” is required.
- Claim 2 (Content-freeness): The two sides of a distinction do not each need to be “something”; one side is that side only because it is not the other.
- Claim 3 (Primacy): Before making a distinction, nothing else needs to exist first, so it can serve as the starting point for all encoding and computation.
These three claims sound abstract, but they correspond exactly to three things in engineering: whether content can be represented (sufficiency), whether names can be assigned freely (content-freeness), and whether a system can bootstrap itself (primacy).
2. Claim 1: Sufficiency—From “Pick One” to “Specify Any One”
2.1 The intuitive construction for the equal-probability case
Suppose there are 8 equally likely, mutually exclusive messages, and you want to specify any one of them. You can do three binary choices: the first picks “the first four or the last four,” the second picks “the first two or the last two” among the remaining four, and the third settles on one message. Three choices, two possibilities each, distinguish 2³ = 8 messages in total.
Generalizing: to specify one message out of n equally likely messages, the number of binary choices needed is log₂ n (rounded up). This “base-2 logarithmic measure” appeared in information transmission research as early as the 1920s, and was later adopted with the “bit” as its unit.
import mathdef bits_needed(n: int) -> int:"""Minimum number of binary choices to select 1 out of n equally likely items"""if n <= 1:return 0return math.ceil(math.log2(n))for n in (8, 1000, 1_000_000):print(n, bits_needed(n)) # 8->3, 1000->10, 1_000_000->20
The point of this code is that it turns “how much content there is” into “how many binary choices are needed”. Once a problem can be written as such a counting problem, we have already entered the territory of information theory.
2.2 Non-equal probabilities: entropy gives the exact lower bound
In reality, messages are almost never equally likely. Suppose a source has n symbols, and the i-th appears with probability pᵢ. Its entropy is defined as:
H = -Σ pᵢ · log₂ pᵢ (unit: bits/symbol)
The noiseless coding theorem tells us: on average, H bits per symbol are enough to encode, and no fewer are possible. This is the exact answer to “how many bits are needed.”
A classic example: four symbols with probabilities 1/2, 1/4, 1/8, 1/8, then
H = 0.5×1 + 0.25×2 + 0.125×3 + 0.125×3 = 1.75 bits/symbol
And the average length of the codewords 0, 10, 110, 111 is exactly 1.75. The measure and the construction align strictly here: not “roughly,” but exactly.
import mathdef entropy_bits(probs):return -sum(p * math.log2(p) for p in probs if p > 0)def avg_len(probs, codewords):return sum(p * len(c) for p, c in zip(probs, codewords))p = [0.5, 0.25, 0.125, 0.125]c = ["0", "10", "110", "111"]print(entropy_bits(p), avg_len(p, c)) # 1.75 1.75
2.3 Why “any content” is not a slogan
Text, images, audio, programs, logs, telemetry data—today all are stored and transmitted in the form of bits, and the devices that store and transmit them do not need to know what that content “is” at all. The reason lies in Claim 1: the system designer does not know which message will actually be selected, so the system must be built to “work correctly for every possible choice.” A line only handles bits, so it can carry anything; a storage device only lands bits, so it can hold anything.
This is the technical root of “generality”: generality is not achieved by enumerating all content, but by remaining ignorant of the content.
3. Claim 2: Content-freeness—The Two Sides Only Need to “Differ”
3.1 Naming is free
The two sides of a distinction can be called 0/1, true/false, engaged/disengaged, high/low, on/off. Which side represents 1 is not dictated by theory. This brings an extremely important engineering property: semantics are decoupled from the carrier.
- Physical layer: as long as two states can be stably distinguished, recovered, and cascaded, it does not matter whether they are voltage levels or magnetization directions.
- Encoding layer: 0/1 are just symbols; the real semantics are assigned by the “interpreter.”
- Application layer: the same bit string can be text, a price, coordinates, or a checksum.
3.2 The “third choice” on the decision boundary
In the real physical world, there is no perfect binary. Noise makes levels float near the threshold. The common engineering practice is to introduce two thresholds and a hysteresis band: below the lower threshold it is judged 0, above the upper threshold it is judged 1, and in between it keeps the previous decision. This upgrades “one binary choice” into “stateful continuous decision-making,” so that content-freeness still holds in noisy environments.
class SchmittTrigger:"""Stable binary decision using dual thresholds plus hysteresis"""def __init__(self, low=0.3, high=0.7, init=0):self.low, self.high = low, highself.state = initdef feed(self, x: float) -> int:if x < self.low:self.state = 0elif x > self.high:self.state = 1return self.state # within the hysteresis band, keep the previous state
What this code embodies is the essence of Claim 2: we never define what the “middle x” actually is; we only define that “it is not the other side.” The absence of semantics buys stability of decision.
3.3 A common misuse: treating “content-free” as “rule-free”
Content-freeness does not mean arbitrariness. It requires:
- Completeness: each operation must fall on one of the two sides (there cannot be a third outcome);
- Mutual exclusivity: it cannot fall on both sides at once;
- Recoverability: both states must be reconstructable after noise.
Violating any of these removes the foundation for all subsequent encoding and compression. For example, if “uncertain” is allowed as a third state and left unhandled, then the entropy lower bound no longer applies, and codeword construction cannot guarantee decodability.
4. Claim 3: Primacy—Bootstrapping and the “Zero Assumption”
4.1 No prerequisite “meta-distinction”
Before making the first distinction, we do not need numbers, language, or units of measurement first. A bistable device itself can start the whole system. This explains why information theory can be derived “from zero”: its only axiom-level assumption is “there exist two distinguishable states.”
At the software level, this corresponds to an extreme but useful design philosophy: reduce all complex structures to a continuous series of “yes/no” questions. Decision trees, binary search, Bloom filters, check bits, prefix codes—they are essentially different wrappers around the same thing.
# Binary search: repeatedly make a binary choice on "in or not" until the interval convergesdef lower_bound(a, x):lo, hi = 0, len(a)while lo < hi:mid = (lo + hi) // 2if a[mid] < x:lo = mid + 1 # choose the "right half"else:hi = mid # choose the "left half"return lo
4.2 Engineering consequences of primacy
Because “distinction” can serve as a starting point, we can first build a minimal working system, then layer on top of it:
- Layer 0: a stable binary decision device (distinction).
- Layer 1: bit strings (ordered repetition of distinctions).
- Layer 2: encoding and compression (modeling the statistical regularities of distinctions).
- Layer 3: error correction and encryption (adding redundancy and unpredictability on top of distinctions).
- Layer 4: files, protocols, databases, models (layering semantic conventions on top of distinctions).
Each layer does not need to “understand” the meaning of the layer above; it only needs to correctly perform “distinguish—combine—distinguish again.” This is the fundamental reason layered systems can work.
5. Engineering Mapping of the Three Claims: A Reusable Analysis Framework
| Claim | Information theory correspondence | Engineering practice correspondence | Consequence of failure |
|---|---|---|---|
| Sufficiency | Entropy gives the lower bound on average bits | General-purpose encoding, unified bit pipeline | The system can only handle preset content |
| Content-freeness | 0/1 naming is arbitrary, semantics-independent | Physical/encoding layer decoupling, hysteresis decision | Noise causes state drift |
| Primacy | Axiom-level assumption, bootstrap derivation | Layered addition, minimal-working-first | The architecture cannot evolve |
This table can be used as a design checklist: when you want to evaluate why a system “can only handle specific data,” “breaks as soon as noise rises,” or “cannot scale smoothly,” the answers usually fall into sufficiency, content-freeness, and primacy respectively.
6. Boundaries and Misconceptions: What the Three Claims Do Not Promise
- They do not promise “short.” Entropy is only an average lower bound; if the distribution is unknown or has long-range correlation, the actual code length may be far higher than a naive estimate. In practice, adaptive models (such as online updates based on historical frequencies) are needed to approach the true distribution.
- They do not promise “immunity to noise.” Distinction is a physical process, and the misjudgment rate is not zero. The role of error-correcting codes is to trade controllable redundancy for an acceptable error rate, not to eliminate errors.
- They do not promise “semantics.” A bit string carries no meaning by itself; the same string of bits may be completely different things under different protocols. Semantics must come from additional conventions and metadata, and this cannot be generated by “distinction” alone.
- They do not promise “reversibility.” Encryption, hashing, and lossy compression all perform irreversible mappings on top of distinctions. What they change is “whether the original content can be recovered from the bit string,” not “whether the bit string exists.”
7. Practical Checklist: Putting the Three Claims Into a System
- Representation layer: first define the “minimal distinguishable unit” (bit/byte/symbol), and specify its boundary decision rule (dual thresholds, hysteresis, sampling rate).
- Measurement layer: for any encoding scheme, first compute H, then compute the actual average code length L; use L−H to measure the gap between the model and entropy coding, rather than tuning parameters by feel.
- Construction layer: prefer prefix codes or arithmetic/range coding; ensure “each choice falls on one of two sides,” avoiding ambiguous prefixes that make decoding impossible.
- Evolution layer: stick to “minimal-working-first,” with each layer depending only on the distinction capability of the layer below, and no cross-layer assumptions about semantics.
- Verification layer: test encoding/decoding consistency and average code length separately with random data and extreme distributions (single symbol, uniform distribution, long tail).
# Diagnosing the gap between entropy and code length: the larger L - H, the more the model deviates from the true distributiondef diagnose(probs, codewords):H = -sum(p * math.log2(p) for p in probs if p > 0)L = sum(p * len(c) for p, c in zip(probs, codewords))return {"H": H, "L": L, "gap": L - H}print(diagnose([0.5, 0.25, 0.125, 0.125], ["0", "10", "110", "111"]))# {'H': 1.75, 'L': 1.75, 'gap': 0.0}
8. Conclusion: Why Distinction Can Be the Starting Point
Back to the original question: what is the minimum needed to express any content? The answer is a distinction. It is sufficient enough, because any content can be reduced to a sequence of binary choices; it is cheap enough, because the two sides do not need to carry meaning; it is self-sustaining enough, because nothing else is needed before making it.
Together, these three points form the shared meta-starting-point of information compression, digital communication, and general-purpose computation. Once you understand it, when facing any question of “why can this encoding/storage/transmission scheme handle arbitrary data,” you can answer along the same main line: first look at how it counts (how many bits), then how it constructs (which codes), and finally how it stays ignorant (makes no assumptions about content).
