Hyperdimensional computing (HDC) represents data as high-dimensional vectors. Three operations: binding (multiply), bundling (add), permutation (shift). Standard HDC uses random vectors of 10,000+ dimensions. CRT gives structured vectors of 7 channels with algebraic guarantees that random vectors cannot match.
CRT decomposition IS HDC. Each character maps to 7 residues: (c%8, c%9, c%25, c%49, c%11, c%13, c%17). Ring multiplication = binding. Ring addition = bundling. CRT reconstruction = decoding. Same algebra -- but with structure instead of randomness.
128 ASCII characters need unique encodings. CRT guarantees uniqueness: any two characters < 214,414,200 have distinct 7-channel vectors. Random encoding (same moduli, random mapping) has no such guarantee. At 3+ shared channels, CRT has zero collisions while random encoding has 68.
Test: predict the next character from the previous one, using a per-channel tally of bigram frequencies. For each predecessor character, record which residues appear in each channel for successor characters. Majority voting decodes the prediction. 471-character diverse corpus.
CRT: 172/470 correct (36.6%). Best random (3 seeds): 168/470 (35.7%). CRT wins across all seeds because majority vectors map cleanly back to real characters. Random majority vectors can be hallucinations -- combinations that match no actual character.
Corrupt channels by overwhelming tally entries with noise. CRT maintains higher accuracy at every corruption level because its algebraic independence means uncorrupted channels still carry valid structure. With 4 of 7 channels corrupted, CRT retains 91/470 vs random 82/470.
With CRT encoding, any 3 of 7 channels uniquely identify 128 ASCII characters. The product of the 3 smallest moduli: 8 * 9 * 11 = 792 > 128. This is error correction for free -- lose 4 channels, keep 3, still decode perfectly. Random encoding: 13 collisions with just 3 channels.
With only 2 channels (product 8*9=72 < 128), CRT has 56 collisions -- decoding fails. The capacity threshold is sharp: 3 channels work, 2 do not. This is error correction (rate 4/7 for Z/214,414,200, rate 3/7 for 128 ASCII) built into the encoding.
Source code · Public domain (CC0)
.ax source compiled to WASM via self-hosting compiler. Zero HTML authored.