SilverSight/docs/HACHIMOJI_DNA_ENCODING.md
allaunthefox 5331d2cc4e feat(dna): unified theory — DNA encoding, epigenetic computation, logarithmic vector spaces
Derivation from first principles:

1. Hachimoji DNA encoding (8 bases, ASCII-ordered, monotone LUT)
2. Imaginary Semantic Time (observer-independent semantic axis)
3. Sieve observers with CRT reconciliation (mod ℓ projections)
4. Semantic mass (E - E_min, E_s = m · 8²)
5. Gap preservation theorem (cleanMerge_preservesGap from GraphRank.lean)
6. Epigenetic computation (bistability, spreading, memory, attractors)
7. Logarithmic vector spaces (Kritchevsky: log N is a geometric vector)
8. Uncomputability framework (baseless logarithm = truth, based = computation)

Epigenetic optimizer breaks the freeze point:
  n=20: 0.7s (brute: 0.3s)
  n=24: 1.5s (brute: FROZEN)
  n=30: 3.4s (brute: FROZEN)
  n=50: 23.9s (brute: FROZEN)

Files:
  docs/UNIFIED_THEORY.md — full theory derivation
  docs/HACHIMOJI_DNA_SYNTAX.md — formal syntax specification
  docs/EPIGENETIC_COMPUTATION.md — epigenetic optimizer
  docs/UNCOMPUTABILITY.md — logarithmic vector space framework
  docs/REDERIVATION.md — rederivation from first principles
  python/dna_*.py — implementation (codec, LUT, GPU, surface)
  tests/test_dna_*.py — 68 tests, all green

Build: N/A (Python + Lean documentation)
2026-06-23 02:18:16 +00:00

2.8 KiB
Raw Blame History

Hachimoji DNA Encoding Specification

Version: 0.1 Status: Draft Purpose: Computational substrate, not compression format.

1. Alphabet

Eight bases, ASCII-ordered for monotone lexicographic sorting:

Index Base Phase Bits
0 A 000
1 B 45° 001
2 C 90° 010
3 G 135° 011
4 P 180° 100
5 S 225° 101
6 T 270° 110
7 Z 315° 111

Key property: ASCII sort order = index order = lexicographic rank. This means sorted(sequences) produces the same order as sorted(sequences, key=dna_to_int).

2. Symbol Encoding

Each symbol (byte, word, or chunk) maps to a fixed-length DNA sequence.

  • 1-byte chunks: 256 symbols → 3 bases/symbol (8³ = 512 ≥ 256)
  • 2-byte chunks: 65,536 symbols → 6 bases/symbol (8⁶ = 262,144 ≥ 65,536)
  • n unique symbols: ceil(log₈(n)) bases/symbol

The LUT assigns sequences by rank:

  • Rank 0 → "AAA...A" (lowest)
  • Rank 1 → "AAA...B"
  • Rank n → highest sequence

3. Monotone Property

If symbols are ranked by frequency (most frequent = rank 0), then:

  • Most frequent symbol → shortest/lowest DNA sequence
  • Lexicographic sort of DNA = frequency sort of symbols
  • This is NOT compression — it's structured representation

4. LUT Format

{
  "format": "hachimoji_lut_v1",
  "bases": "ABCGPSTZ",
  "chunk_size": 1,
  "bases_per_symbol": 3,
  "entries": {
    "AAA": "20",
    "AAB": "65",
    "AAC": "74"
  }
}
  • Keys: DNA sequences (base-8 encoded ranks)
  • Values: hex-encoded byte chunks
  • Portable: JSON, human-readable, self-describing

5. File Format

.dna file:  raw DNA sequence (text, A-Z only)
.lut file:  JSON LUT (see above)
.meta file: encoding metadata (optional JSON)

6. Roundtrip Guarantee

decode(encode(data)) == data

Verified at encode time. No lossy steps. No approximation.

7. Computational Properties

The DNA sequence is not just encoded data — it's a computational address:

  • Sequence index (base-8 integer) = symbolic rank
  • Lexicographic order = rank order (monotone)
  • LUT lookup = O(1) per symbol
  • Sortable by standard string sort (= rank sort)
  • Portable across systems (plain text + JSON)

8. Integration with SilverSight

  • HachimojiCodec.lean — formal encode/decode specification
  • HachimojiLUT.lean — LUT hierarchy (k=2, k=6, k=50)
  • PhaseCircle/360 address space
  • dna_lut.py — Python LUT implementation
  • dna_encode_file.py — file encoder/decoder

9. Not This

  • Not a compression format (bits/byte not the goal)
  • Not a DNA storage format (no synthesis/sequencing constraints)
  • Not a cryptographic scheme (no security claims)
  • A computational substrate for manifold/QUBO/eigenvalue work