Research-Stack/4-Infrastructure/shim/ingest_compactified_core_equations.py
Brandon Schneider 79cdb0f9b5 ingest: Compactified core equations (12 → 4 primitives, 67% reduction)
Compactified 12 core equations to 4 primitives based on analysis (109/120
matches, 90.8% coverage maintained).

4 primitives:
1. Field primitive: ρ(x⃗) — derives Morse-Smale, radius_ratio,
   residual_ratio, S3C shells
2. Shear primitive: G = A^T A — derives shear_matrix, FAMM delays,
   eigen decomposition
3. Packet primitive: Γᵢ = γᵢ ⊗ χᵢ ⊗ κᵢ ⊗ τᵢ ⊗ UᵢΛᵢaᵢ ⊗ θᵢ ⊗ εᵢ —
   includes gain test
4. Spectral primitive: C = UΛU^T — derives residual correlation,
   eigen decomposition, spectral pruning

Redundancies resolved:
- shear_matrix + gram_matrix → shear primitive
- residual_correlation + eigen_decomposition → spectral primitive
- radius_ratio, residual_ratio derived from field primitive

Topological compactification: 10 theories = projections of 4D compact
manifold. Master synthesis = atlas covering all coordinate charts.

67% reduction (12 → 4) with 90.8% coverage maintained. Simplified
implementation, unified framework, topological clarity.
2026-05-08 14:50:02 -05:00

223 lines
12 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""
Ingest: Compactified Core Equations
===================================
Compactify 12 core equations to 4 primitives (67% reduction).
Maintains 90.8% coverage across theories.
"""
import json, time
from pathlib import Path
RESEARCH_STACK = Path("/home/allaun/Documents/Research Stack")
COMPACTIFIED_EQUATIONS = {
"id": "compactified-core-equations-v1",
"source": "Compactification of 12 core equations to 4 primitives based on analysis (109/120 matches, 90.8% coverage)",
"title": "Compactified Core Equations: 4 Primitives for Compression Architecture",
"date": "2026-05-07",
"core_synthesis": (
"12 core equations compactified to 4 primitives (67% reduction) while maintaining "
"90.8% coverage across compression theories. Redundant equations merged: shear_matrix + "
"gram_matrix → shear primitive; residual_correlation + eigen_decomposition → spectral "
"primitive. Derivable equations expressed as derived metrics: radius_ratio, residual_ratio "
"derived from field primitive. Topological compactification: 10 theories viewed as "
"projections of 4D compact manifold (field, shear, packet, spectral)."
),
"compactification_rationale": {
"original_12_equations": "density_field, morse_smale, shear_matrix, gram_matrix, gccl_packet, gain_test, s3c_shell, radius_ratio, residual_ratio, famm_delay, residual_correlation, eigen_decomposition",
"analysis_results": "109/120 equation-theory matches (90.8% coverage). 7 equations with full coverage, 5 with partial coverage, 0 with no coverage.",
"redundancies_identified": {
"shear_gram": "shear_matrix (A_{ij} = δ_{ij} + α_{ij}) and gram_matrix (G = A^T A) linked. Gram derives from shear.",
"correlation_eigen": "residual_correlation (C_{ij} = ⟨ε_i ε_j⟩) and eigen_decomposition (C = UΛU^T) form pipeline.",
"field_derivatives": "radius_ratio (ρᵢ = s_center(i) / median(s(N(i)))) and residual_ratio (ρ = |ε| / |raw_span|) derived from field topology."
},
"compactification_ratio": "12 → 4 primitives (67% reduction)"
},
"compactified_primitives": {
"field_primitive": {
"equation": "ρ(x⃗)",
"latex": "\\rho(\\vec{x})",
"description": "Semantic density field representing text as n-D manifold with topological features (peaks, ridges, saddles, vortices, voids)",
"derives": [
"morse_smale: Critical points + separatrices = topological skeleton of meaning",
"radius_ratio: ρᵢ = ∇ρ(x⃗) / |∇ρ(x⃗)| at critical points (local scale ratio)",
"residual_ratio: ρ = ||ε||_2 / ||s||_2 (residual metric derived from field)",
"s3c_shell: n = k² + a (shell coordinates encode field structure)"
],
"coverage": "70-80% across theories (density_field, morse_smale, s3c_shell, radius_ratio, residual_ratio)"
},
"shear_primitive": {
"equation": "G = A^T A",
"latex": "G = A^T A",
"description": "Gram matrix = compression dictionary. Shear matrix A transforms orthogonal hypercube to correlated rhomboid. Eigenvectors = principal correlation directions, eigenvalues = compression gains",
"derives": [
"shear_matrix: A_{ij} = δ_{ij} + α_{ij} (encoding of G)",
"famm_delay: Delay = ∫_γ ∇ρ · dl (path integral through sheared field gradient)"
],
"coverage": "100% across theories (shear_matrix, gram_matrix, famm_delay, eigen_decomposition)"
},
"packet_primitive": {
"equation": "Γᵢ = γᵢ ⊗ χᵢ ⊗ κᵢ ⊗ τᵢ ⊗ UᵢΛᵢaᵢ ⊗ θᵢ ⊗ εᵢ",
"latex": "\\Gamma_i = \\gamma_i \\otimes \\chi_i \\otimes \\kappa_i \\otimes \\tau_i \\otimes U_i\\Lambda_i a_i \\otimes \\theta_i \\otimes \\varepsilon_i",
"description": "GCCL glyph packet with chirality, type, eigen descriptor, residual. Gain test ΔGCL > 0 filters compressive motifs",
"derives": [
"gain_test: ΔGCL > 0 (filter applied to packet acceptance)",
"gccl_packet: Full packet formula (the primitive itself)"
],
"coverage": "90% across theories (gccl_packet, gain_test)"
},
"spectral_primitive": {
"equation": "C = UΛU^T",
"latex": "C = U\\Lambda U^T",
"description": "Eigen decomposition of correlation matrix. Residual correlation C_{ij} = ⟨ε_i ε_j⟩. Spectral energy compaction: 90% energy in 10% coefficients",
"derives": [
"residual_correlation: C_{ij} = ⟨ε_i ε_j⟩ (input to spectral decomposition)",
"eigen_decomposition: C = UΛU^T (the primitive itself)",
"famm_spectral: Delays weighted by eigenvalue spectra (spectral pruning)"
],
"coverage": "60-100% across theories (residual_correlation, eigen_decomposition, erans field effect)"
}
},
"topological_compactification": {
"concept": "10 compression theories viewed as projections of 4D compact manifold",
"manifold_dimensions": {
"dimension_0_field": "ρ(x⃗) — density field primitive (semantic manifold structure)",
"dimension_1_shear": "G = A^T A — shear primitive (geometric transformation)",
"dimension_2_packet": "Γᵢ = γᵢ ⊗ χᵢ ⊗ κᵢ ⊗ τᵢ ⊗ UᵢΛᵢaᵢ ⊗ θᵢ ⊗ εᵢ — packet primitive (encoding unit)",
"dimension_3_spectral": "C = UΛU^T — spectral primitive (residual decomposition)"
},
"theory_projections": {
"density_field_encoding_theory": "Projection onto dimension 0 (field) with partial spectral",
"observer_admissible_cavities_theory": "Projection onto dimensions 0-2 (field + shear + packet)",
"hypercube_rhomboid_composition": "Projection onto dimension 1 (shear) with spectral",
"gccl_gec_spec_v1": "Projection onto dimensions 2-3 (packet + spectral)",
"unified_compression_architecture_synthesis_v1": "Full 4D projection (all primitives)",
"hippocampus_tabula_plena_combined_v1": "Full 4D projection with biological constraints",
"erans_field_effect_spectrum_v1": "Projection onto dimensions 0-3 with spectral emphasis",
"master_synthesis_complete_v1": "Complete 4D manifold with all projections integrated"
},
"coordinate_charts": "Each theory is a different coordinate chart on the 4D manifold. Master synthesis is the atlas covering all charts."
},
"compactification_benefits": {
"reduction": "12 equations → 4 primitives (67% reduction)",
"coverage_maintained": "90.8% coverage maintained across theories",
"simplified_implementation": "4 core primitives easier to implement and verify than 12 equations",
"unified_framework": "4 primitives provide unified framework for all compression theories",
"topological_clarity": "4D manifold structure reveals relationships between theories",
"computational_efficiency": "Spectral primitive enables energy compaction (10-20% gain on residuals)",
"biological_alignment": "Field primitive aligns with hippocampus density fields, spectral with pattern separation"
},
"implementation_mapping": {
"field_primitive_implementation": {
"stage": "Stage 1: density field extraction",
"code": "Compute ρ(x⃗) from corpus C. Extract Morse-Smale topological skeleton.",
"outputs": "Peaks, ridges, saddles, vortices, voids, level_sets, S3C shell coordinates"
},
"shear_primitive_implementation": {
"stage": "Stage 2: shear matrix computation",
"code": "Compute shear matrix A, Gram matrix G = A^T A. Eigen-decompose G = UΛU^T.",
"outputs": "Eigenvectors (principal directions), eigenvalues (compression gains), FAMM delay profile"
},
"packet_primitive_implementation": {
"stage": "Stage 7: GCCL packet construction",
"code": "Construct Γᵢ = γᵢ ⊗ χᵢ ⊗ κᵢ ⊗ τᵢ ⊗ UᵢΛᵢaᵢ ⊗ θᵢ ⊗ εᵢ. Apply gain test ΔGCL > 0.",
"outputs": "Glyph packets with chirality, type, eigen descriptor, parameters, residual"
},
"spectral_primitive_implementation": {
"stage": "Stage 13: erans spectral entropy coding",
"code": "Compute residual correlation C_{ij} = ⟨ε_i ε_j⟩. Eigen-decompose C = UΛU^T. Code spectral coefficients with erans.",
"outputs": "Spectral coefficients (eigenvalues, eigenvector weights), entropy-coded residuals"
}
},
"keeper_phrases": [
"12 equations compactified to 4 primitives: field, shear, packet, spectral.",
"Field primitive ρ(x⃗) derives Morse-Smale, radius_ratio, residual_ratio, S3C shells.",
"Shear primitive G = A^T A derives shear_matrix, FAMM delays, eigen decomposition.",
"Packet primitive Γᵢ = γᵢ ⊗ χᵢ ⊗ κᵢ ⊗ τᵢ ⊗ UᵢΛᵢaᵢ ⊗ θᵢ ⊗ εᵢ includes gain test.",
"Spectral primitive C = UΛU^T derives residual correlation, eigen decomposition, spectral pruning.",
"67% reduction (12 → 4) with 90.8% coverage maintained.",
"10 theories = projections of 4D compact manifold.",
"Master synthesis = atlas covering all coordinate charts.",
"Spectral energy compaction: 90% energy in 10% coefficients.",
"Field primitive aligns with hippocampus density fields.",
"Spectral primitive aligns with hippocampus pattern separation.",
"Compactification reveals topological structure of compression architecture."
],
"metadata": {
"ingested_at": time.time(),
"tags": [
"compactified-equations",
"4-primitives",
"field-primitive",
"shear-primitive",
"packet-primitive",
"spectral-primitive",
"topological-compactification",
"4d-manifold",
"coordinate-charts",
"67-percent-reduction",
"90-8-percent-coverage",
"compression-architecture"
]
}
}
def ingest():
germane_dir = RESEARCH_STACK / "shared-data/data/germane/research"
germane_dir.mkdir(parents=True, exist_ok=True)
out_path = germane_dir / "compactified_core_equations_v1.json"
with open(out_path, 'w') as f:
json.dump(COMPACTIFIED_EQUATIONS, f, indent=2)
print(f"✓ Ingested: {out_path}")
index_path = germane_dir / "research_ingestion_index.json"
index = []
if index_path.exists():
with open(index_path) as f:
index = json.load(f)
index.append({
"id": COMPACTIFIED_EQUATIONS["id"],
"title": COMPACTIFIED_EQUATIONS["title"],
"date": COMPACTIFIED_EQUATIONS["date"],
"source": COMPACTIFIED_EQUATIONS["source"],
"ingested_at": COMPACTIFIED_EQUATIONS["metadata"]["ingested_at"],
"tags": COMPACTIFIED_EQUATIONS["metadata"]["tags"],
})
with open(index_path, 'w') as f:
json.dump(index, f, indent=2)
print(f"✓ Index: {len(index)} entries")
print(f"\nCompactification ratio: 12 → 4 primitives (67% reduction)")
print(f"Coverage maintained: 90.8%")
print(f"\n4 primitives:")
for prim, data in COMPACTIFIED_EQUATIONS["compactified_primitives"].items():
print(f"{prim}: {data['equation']}{data['description'][:60]}...")
print(f"\nTopological compactification:")
print(f" 10 theories = projections of 4D compact manifold")
for dim, desc in COMPACTIFIED_EQUATIONS["topological_compactification"]["manifold_dimensions"].items():
print(f"{dim}: {desc[:60]}...")
print(f"\nKeeper phrases ({len(COMPACTIFIED_EQUATIONS['keeper_phrases'])}):")
for p in COMPACTIFIED_EQUATIONS['keeper_phrases']:
print(f"{p}")
if __name__ == "__main__":
ingest()