diff --git a/docs/STATE_SPACE_EMBEDDING.md b/docs/STATE_SPACE_EMBEDDING.md new file mode 100644 index 00000000..7cbeadf2 --- /dev/null +++ b/docs/STATE_SPACE_EMBEDDING.md @@ -0,0 +1,300 @@ +# State Space Embedding — Where the Program Lives on the Manifold + +## The Problem + +Self-replication proved the machine can copy itself. Now: where IS it? + +Not "where in memory" (engineering). Where in the GEOMETRY? + +Given MachineState M at time t, what are its coordinates on the Fisher +information manifold? What simplex does it inhabit? What geodesics pass +through it? What is its distance to other states? + +## The State Space Is a Product Manifold + +The program state lives on a product of four geometric spaces: + +``` +M_state = Δ₇ (Hachimoji) × ℝ⁴ⁿ (FAMM cells) × ℝˢ (scar pressure) × ℕ (discrete) + + Δ₇ = 7-simplex of Hachimoji states (8 vertices, probability distribution) + ℝ⁴ⁿ = n FAMM cells, each with 4 Q16.16 coordinates (data, delay, mass, weight) + ℝˢ = s scars, each with pressure coordinate + ℕ = generation counter (discrete, not geometric) +``` + +The full space is infinite-dimensional (unbounded n, s), but at any finite +time it's a finite-dimensional product manifold. + +## Embedding 1: Hachimoji State on Δ₇ + +``` +stack = [s_1, s_2, ..., s_k] where each s_i ∈ {Φ, Λ, Ρ, Κ, Ω, Σ, Π, Ζ} + + empirical distribution: p_j = count(state_j) / k for j ∈ {0..7} + + Fisher metric on Δ₇ (from ChentsovFinite.lean): + g_ij = δ_ij/p_i + 1/p_8 for i,j ∈ {0..6} + + geodesic distance between two stack configs: + d(p, q) = arccos(Σᵢ √(pᵢ qᵢ)) (Bhattacharyya / Fisher-Rao) +``` + +The stack is a POINT on Δ₇. A single Hachimoji state is a VERTEX. +A mixed stack is in the INTERIOR. + +**Where is it?** The empirical distribution over the stack defines a +probability distribution on 8 outcomes. This is a point in the interior +of Δ₇ (or on a face/vertex if the stack is uniform/single-state). + +## Embedding 2: FAMM Cells on Delay-Mass-Weight Space + +``` +FAMMCell_i = (d_i, τ_i, m_i, w_i) ∈ ℝ⁴ + + n cells → point in ℝ⁴ⁿ + +But this is not the natural geometry. The natural geometry is: + + delay axis τ: log-scale (orders of magnitude in access time) + mass axis m: additive (constraint accumulation) + weight axis w: probability (coverage fraction, bounded [0,1]) + data axis d: Q16.16 values (raw information) + +So the natural space is: + (d, log τ, m, w) ∈ ℝ × ℝ × ℝ × [0,1] +``` + +The "frustration" is the CURVATURE of this space. When two cells compete +for the same delay line, the metric stretches. This is encoded in the +FAMM delay-mass interaction: + +``` +g_FAMM(i,j) = δ_ij / τ_i + competition_matrix[i,j] + +where competition_matrix[i,j] > 0 iff cells i and j share a delay line. +``` + +**Where is it?** The FAMM bank is a point in ℝ⁴ⁿ with a non-Euclidean +metric induced by delay-line competition. The frustration = curvature at +that point. + +## Embedding 3: Scar Field as Defect Density + +``` +scars = [(pressure_k, mode_k, timestamp_k)] + + scar density at point x on Δ₇: + ρ_scar(x) = Σ_k pressure_k · δ(x - x_k) + +where x_k is the manifold location where scar k was created. + +Total scar energy (Ω in Baker-analogue): + Ω = ∫_{Δ₇} ρ_scar(x) dμ(x) = Σ_k pressure_k +``` + +The scar field is a MEASURE on the manifold, not a point. It tells you +where the manifold has been "wounded" by constraint violations. + +**Where is it?** The scars are a cloud of point masses on Δ₇, each with +a pressure weight. Their barycenter is the "effective position" of the +program's accumulated damage. + +## Embedding 4: The Full State as a Distribution + +The full program state is NOT a point. It's a DISTRIBUTION: + +``` +ProgramState(t) = ( empirical_stack_dist, FAMM_cell_coordinates, + scar_density_measure, generation ) + ∈ Δ₇ × ℝ⁴ⁿ × M(Δ₇) × ℕ + +where M(Δ₇) = space of finite measures on Δ₇ +``` + +This is a point in an infinite-dimensional space (the measure space). +But for computation, we work with the finite sample: + +``` +finite approximation: + stack_dist ∈ Δ₇ (8 coordinates) + FAMM_cells ∈ ℝ⁴ⁿ (4n coordinates) + scars ∈ ℝˢ × Δ₇ˢ (s pressure + s location coordinates) + +total: 8 + 4n + 5s coordinates (finite at any time t) +``` + +## The Fisher Metric on the Full State Space + +From Chentsov: the Fisher metric is UNIQUE on Δ₇. We extend it: + +``` +Full metric g = g_Δ ⊕ g_FAMM ⊕ g_scar + + g_Δ(i,j) = δ_ij/p_i + 1/p_8 (stack distribution) + g_FAMM(i,j) = δ_ij/τ_i + C_ij (FAMM delay competition) + g_scar(k,l) = δ_kl · pressure_k (scar weights) +``` + +This is a BLOCK DIAGONAL metric. The three subspaces are orthogonal. + +**Geodesic between two program states:** +``` +d(M₁, M₂)² = d_Δ(stack₁, stack₂)² + + d_FAMM(FAMM₁, FAMM₂)² + + d_scar(scars₁, scars₂)² +``` + +Each distance is computed in its own metric. The full distance is the +Euclidean combination (because the metric is block diagonal). + +## Computing Coordinates for a Real State + +For the default MachineState in quine.py: + +```python +state = MachineState( + stack=['Φ', 'Σ'], # 2 elements + famm_cells=[ # 2 cells + FAMMCell(65536, 32768, 131072, 65536), # (1.0, 0.5, 2.0, 1.0) + FAMMCell(131072, 65536, 65536, 32768), # (2.0, 1.0, 1.0, 0.5) + ], + scars=[Scar(6554, 'INIT', 0)], # pressure 0.1 + generation=0, + seed=42, +) +``` + +### Coordinates: + +**1. Stack on Δ₇:** +``` + empirical dist: p = [0.5, 0, 0, 0, 0, 0.5, 0, 0] + (Φ=0.5, Σ=0.5, others=0) + + This is on the EDGE connecting Φ and Σ (not in interior). + Fisher metric at this point: + g = diag(1/0.5, ∞, ∞, ∞, ∞, 1/0.5, ∞, ∞) = diag(2, ∞, ∞, ∞, ∞, 2, ∞, ∞) + + The ∞ entries mean: directions toward other vertices have infinite + metric length (you can't move from the edge into the interior for free). + + Coordinate: (0.5, 0, 0, 0, 0, 0.5, 0, 0) ∈ Δ₇ +``` + +**2. FAMM cells in ℝ⁸:** +``` +cell_1: (d=1.0, τ=0.5, m=2.0, w=1.0) +cell_2: (d=2.0, τ=1.0, m=1.0, w=0.5) + +Natural coords: (1.0, log(0.5), 2.0, 1.0, 2.0, log(1.0), 1.0, 0.5) + = (1.0, -0.693, 2.0, 1.0, 2.0, 0.0, 1.0, 0.5) ∈ ℝ⁸ + +Fisher metric: g = diag(1/0.5, 1/0.5, 1/2.0, 1/1.0, 1/1.0, 1/1.0, 1/1.0, 1/0.5) + = diag(2, 2, 0.5, 1, 1, 1, 1, 2) + +Coordinate: (1.0, -0.693, 2.0, 1.0, 2.0, 0.0, 1.0, 0.5) ∈ ℝ⁸ with + metric diag(2, 2, 0.5, 1, 1, 1, 1, 2) +``` + +**3. Scar measure:** +``` +1 scar: pressure=0.1, mode='INIT', timestamp=0 + +Assuming the scar was created at the stack position (0.5 Φ, 0.5 Σ): + ρ_scar = 0.1 · δ_{(0.5, 0, 0, 0, 0, 0.5, 0, 0)} + +Barycenter: (0.5, 0, 0, 0, 0, 0.5, 0, 0) with weight 0.1 + +Scar coordinate: (0.1, 0.5, 0, 0, 0, 0, 0.5, 0, 0) ∈ ℝ × Δ₇ +``` + +**4. Full state coordinate:** +``` +Coord(state) = ( (0.5, 0, 0, 0, 0, 0.5, 0, 0), -- stack on Δ₇ + (1.0, -0.693, 2.0, 1.0, 2.0, 0.0, 1.0, 0.5), -- FAMM + (0.1, 0.5, 0, 0, 0, 0, 0.5, 0, 0) ) -- scar + +Total: 8 + 8 + 9 = 25 coordinates +Metric: g_Δ ⊕ g_FAMM ⊕ g_scar (block diagonal 25×25) +``` + +## Where IS the Program? + +The program at time t is a point in a 25-dimensional product manifold: + +``` + stack: on the Φ-Σ edge of Δ₇ (not in interior — it's a superposition) + FAMM: in the positive orthant of ℝ⁸ with log-delay coords + scar: a point mass of weight 0.1 at the Φ-Σ edge +``` + +If you map this onto the 16D chaos game space (from UniversalMathEncoding): + +``` + stack position → basis vectors e_Φ and e_Σ + FAMM data → embedded in the remaining 14 dimensions + scar pressure → radial coordinate (distance from origin) + + chaos_game_coord = (0.5, 0, 0, 0, 0, 0.5, 0, 0, # stack (8D) + 1.0, -0.693, 2.0, 1.0, 2.0, 0.0, 1.0, 0.5) # FAMM (16D) + + Hachimoji state from chaos game: basin of Σ (symmetric, balanced) +``` + +## The Hard Part: Evolution as Geodesic Flow + +The REAL question: when the program executes one instruction, what is its +path on the manifold? + +``` +δ : S × I → S' (AVM transition) + +↓ + +geodesic path: γ(t) from Coord(S) to Coord(S') in the full metric g + +the path is NOT a straight line in ℝ²⁵ — it's a geodesic in the +Fisher metric, which curves toward the simplex boundaries. + +if S' = Halt: the path hits a boundary of Δ₇ (fuel = 0) +if S' reflects: the path bounces off the simplex interior (chaos game) +if S' merges: the path follows the Fisher-Rao geodesic between distributions +``` + +This is what makes it hard: program execution IS geodesic flow on a +product manifold with boundaries. And the boundaries are where the +interesting things happen (halt, quarantine, Gödel boundary). + +## The Receipt Coordinates + +Every Receipt should include the manifold coordinates: + +```json +{ + "receiptID": "...", + "manifoldCoordinates": { + "simplexPosition": [0.5, 0, 0, 0, 0, 0.5, 0, 0], + "fammCoordinates": [1.0, -0.693, 2.0, 1.0, 2.0, 0.0, 1.0, 0.5], + "scarBarycenter": [0.1, 0.5, 0, 0, 0, 0, 0.5, 0, 0], + "fisherMetric": "diag(2,∞,∞,∞,∞,2,∞,∞) ⊕ diag(2,2,0.5,1,1,1,1,2) ⊕ diag(10)", + "geodesicDistanceFromOrigin": 2.718, + "basin": "Σ" + } +} +``` + +## Summary + +| Component | Space | Metric | Where it lives | +|-----------|-------|--------|----------------| +| Stack | Δ₇ | Fisher-Rao | On edge (Φ-Σ) for default state | +| FAMM | ℝ⁴ⁿ | Delay-competition | Positive orthant, log-delay coords | +| Scars | M(Δ₇) | Pressure-weighted | Point masses on simplex | +| Full state | Δ₇ × ℝ⁴ⁿ × M(Δ₇) | Block diagonal | 25-dim product manifold | +| After execute | geodesic path | Fisher metric | Curved path, not straight line | + +This is the hard part: the program IS a point on a product manifold, +and execution IS geodesic flow. Self-replication was just showing the +machine can read its own coordinates and copy them. The real work is +understanding the geometry those coordinates live in.