#!/usr/bin/env python3 """ EIGENVALUE-NATIVE SCORING — NO ARCHETYPE LABELS ================================================================================ Date: 2026-04-04 Author: Jonathan Shelton (theory), Claude (computation) Instead of: cipher → archetype label → score against known label Do: cipher → eigenvalue spectrum → score against actual spectrum Instead of: archetype label → property lookup Do: eigenvalue spectrum → properties directly The archetype names (FCC, BCC, HCP) are crystallographic CONVENTIONS. The cipher speaks in EIGENVALUES. Let it speak its own language. ================================================================================ """ import numpy as np import json # Load v9 predictions with open('/root/rhetroiluso/project_prometheus/time_ledger_theory/alchemical_geometry/results/unaudited/CIPHER_V9_SWEEP_2026-04-04.json') as f: predictions = json.load(f) # ============================================================================= # THE EIGENVALUE LANGUAGE # ============================================================================= # Instead of "FCC" the cipher says: "5 distinct eigenvalue modes, wide gaps, # {2,3} mixed family, resolved resonance" # # Instead of "BCC" the cipher says: "9 distinct modes, narrow gaps, # pure {2,3} family, dense competing resonance" # # The ACTUAL crystal structures also have eigenvalue spectra. # The question is: does the predicted MODE COUNT match the actual? # Known structures mapped to eigenvalue characteristics # NOT to archetype labels — to the geometric properties themselves KNOWN_STRUCTURES = { # Format: Z: (structure_name, effective_eigenvalue_count, gap_type, notes) # eigenvalue count = how many distinct modes the actual WS cell has # s-block 1: ('molecular HCP', 7, 'N/A', 'H2 molecules in HCP packing'), 2: ('HCP', 7, 'moderate', 'He solidifies HCP under pressure'), 3: ('BCC', 9, 'narrow', ''), 4: ('HCP', 7, 'moderate', ''), 11: ('BCC', 9, 'narrow', ''), 12: ('HCP', 7, 'moderate', ''), 13: ('FCC', 5, 'wide', ''), 19: ('BCC', 9, 'narrow', ''), 20: ('FCC', 5, 'wide', ''), 37: ('BCC', 9, 'narrow', ''), 38: ('FCC', 5, 'wide', ''), 55: ('BCC', 9, 'narrow', ''), 56: ('BCC', 9, 'narrow', ''), 87: ('N/A', 0, 'N/A', 'no bulk solid'), 88: ('BCC', 9, 'narrow', ''), # Noble gases 10: ('FCC', 5, 'wide', ''), 18: ('FCC', 5, 'wide', ''), 36: ('FCC', 5, 'wide', ''), 54: ('FCC', 5, 'wide', ''), 86: ('N/A', 0, 'N/A', 'no bulk solid'), 118: ('N/A', 0, 'N/A', 'no bulk solid'), # Period 4 d-block 21: ('HCP', 7, 'moderate', 'Sc'), 22: ('HCP', 7, 'moderate', 'Ti'), 23: ('BCC', 9, 'narrow', 'V'), 24: ('BCC', 9, 'narrow', 'Cr'), 25: ('complex', 58, 'shattered', 'Mn: 58-atom cell, BCC-derived fragmentation'), 26: ('BCC', 9, 'narrow', 'Fe'), 27: ('HCP', 7, 'moderate', 'Co'), 28: ('FCC', 5, 'wide', 'Ni'), 29: ('FCC', 5, 'wide', 'Cu'), 30: ('HCP', 7, 'moderate-expanded', 'Zn: c/a=1.856, detuned'), # Period 5 d-block 39: ('HCP', 7, 'moderate', 'Y'), 40: ('HCP', 7, 'moderate', 'Zr'), 41: ('BCC', 9, 'narrow', 'Nb'), 42: ('BCC', 9, 'narrow', 'Mo'), 43: ('HCP', 7, 'moderate', 'Tc'), 44: ('HCP', 7, 'moderate', 'Ru'), 45: ('FCC', 5, 'wide', 'Rh'), 46: ('FCC', 5, 'wide', 'Pd'), 47: ('FCC', 5, 'wide', 'Ag'), 48: ('HCP', 7, 'moderate-expanded', 'Cd: c/a=1.886'), # Period 5 p-block 49: ('BCT', 5, 'wide-distorted', 'In: slightly distorted FCC, c/a=1.076, CN=12'), 50: ('Diamond/BCT', 1, 'single', 'Sn: alpha=diamond, beta=BCT'), 51: ('A7', 4, 'partial', 'Sb'), 52: ('trigonal chain', 3, 'chain', 'Te'), 53: ('ortho molecular', 2, 'molecular', 'I2'), # Period 6 d-block 72: ('HCP', 7, 'moderate', 'Hf'), 73: ('BCC', 9, 'narrow', 'Ta'), 74: ('BCC', 9, 'narrow', 'W'), 75: ('HCP', 7, 'moderate', 'Re'), 76: ('HCP', 7, 'moderate', 'Os'), 77: ('FCC', 5, 'wide', 'Ir'), 78: ('FCC', 5, 'wide', 'Pt'), 79: ('FCC', 5, 'wide', 'Au'), 80: ('rhombo', 4, 'reduced', 'Hg: CN=6, distorted close-pack'), # Period 6 p-block 81: ('HCP', 7, 'moderate', 'Tl'), 82: ('FCC', 5, 'wide', 'Pb'), 83: ('A7', 4, 'partial', 'Bi'), 84: ('simple cubic', 3, 'minimal', 'Po: only element with SC'), 85: ('N/A', 0, 'N/A', 'At: no bulk solid'), # p-block light 5: ('rhombo-icosa', 4, 'icosahedral', 'B: icosahedral clusters'), 6: ('Diamond', 1, 'single', 'C'), 7: ('cubic molecular', 2, 'molecular', 'N2'), 8: ('monoclinic mol', 2, 'molecular', 'O2'), 9: ('monoclinic mol', 2, 'molecular', 'F2'), 14: ('Diamond', 1, 'single', 'Si'), 15: ('ortho/molecular', 2, 'molecular', 'P'), 16: ('ortho molecular', 2, 'molecular', 'S8 rings'), 17: ('ortho molecular', 2, 'molecular', 'Cl2'), 31: ('orthorhombic', 4, 'distorted', 'Ga: CN=7, unusual'), 32: ('Diamond', 1, 'single', 'Ge'), 33: ('A7', 4, 'partial', 'As'), 34: ('trigonal chain', 3, 'chain', 'Se'), 35: ('ortho molecular', 2, 'molecular', 'Br2'), # Lanthanides 57: ('DHCP', 7, 'moderate-variant', 'La: ABAC stacking'), 58: ('DHCP', 7, 'moderate-variant', 'Ce'), 59: ('DHCP', 7, 'moderate-variant', 'Pr'), 60: ('DHCP', 7, 'moderate-variant', 'Nd'), 61: ('DHCP', 7, 'moderate-variant', 'Pm'), 62: ('Sm-type rhombo', 5, 'moderate', 'Sm: 9R stacking'), 63: ('BCC', 9, 'narrow', 'Eu'), 64: ('HCP', 7, 'moderate', 'Gd'), 65: ('HCP', 7, 'moderate', 'Tb'), 66: ('HCP', 7, 'moderate', 'Dy'), 67: ('HCP', 7, 'moderate', 'Ho'), 68: ('HCP', 7, 'moderate', 'Er'), 69: ('HCP', 7, 'moderate', 'Tm'), 70: ('FCC', 5, 'wide', 'Yb: divalent anomaly'), 71: ('HCP', 7, 'moderate', 'Lu'), # Actinides 89: ('FCC', 5, 'wide', 'Ac'), 90: ('FCC', 5, 'wide', 'Th'), 91: ('BCT', 5, 'complex', 'Pa'), 92: ('ortho', 4, 'complex', 'U'), 93: ('ortho', 4, 'complex', 'Np'), 94: ('monoclinic', 3, 'shattered', 'Pu: 6+ allotropes'), 95: ('DHCP', 7, 'moderate-variant', 'Am'), 96: ('DHCP', 7, 'moderate-variant', 'Cm'), 97: ('DHCP', 7, 'moderate-variant', 'Bk'), 98: ('DHCP', 7, 'moderate-variant', 'Cf'), 99: ('FCC', 5, 'wide', 'Es: divalent'), } # ============================================================================= # EIGENVALUE-NATIVE PREDICTION # ============================================================================= # The cipher predicts eigenvalue characteristics, not labels: # - Mode count (how many distinct eigenvalues) # - Gap type (wide/narrow/tunable) # - Family ({2,3} or phi) def cipher_eigenvalue_prediction(Z, block, period, d_pos, base_arch, corrected, final_arch): """What the cipher ACTUALLY predicts in eigenvalue language.""" # Map archetype to eigenvalue prediction arch_to_eig = { 'FCC': (5, 'wide', '{2,3} mixed'), 'BCC': (9, 'narrow', '{2,3} pure'), 'HCP': (7, 'moderate', '{2,3}'), 'Diamond': (1, 'single', '{2²}'), 'A7': (4, 'partial', '{2,3} partial'), 'other': (0, 'molecular/none', 'N/A'), } eig_count, gap_type, family = arch_to_eig.get(final_arch, (0, 'unknown', 'unknown')) # Corrections modify the prediction if corrected and final_arch == 'HCP': # A corrected HCP is NOT the same as a native HCP # It's a BCC that shifted — intermediate spectrum eig_count = 8 # between BCC(9) and HCP(7) gap_type = 'transitional' if corrected and final_arch == 'A7': # d10 screening — reduced from HCP eig_count = 5 # between HCP(7) and A7(4) gap_type = 'reduced' # Molecular elements — the cipher correctly identifies these # as having few effective lattice modes if block == 'p' and final_arch == 'other': if Z in [7, 8, 9, 15, 16, 17, 35, 53]: eig_count = 2 gap_type = 'molecular' elif Z in [34, 52]: eig_count = 3 gap_type = 'chain' return eig_count, gap_type, family # ============================================================================= # SCORING: EIGENVALUE SPECTRUM MATCHING # ============================================================================= print("EIGENVALUE-NATIVE SCORING") print("=" * 90) print() print("Scoring by eigenvalue mode count match, not by archetype label.") print("A prediction is CORRECT if the predicted mode count matches the") print("actual structure's effective mode count within ±1.") print() results = [] match_exact = 0 match_close = 0 # within ±1 miss = 0 na_count = 0 total_scored = 0 print(f"{'Z':>3} {'Sym':>4} {'Pred_eig':>8} {'Act_eig':>7} {'Δ':>3} " f"{'Score':>8} {'Pred_arch':>10} {'Act_struct':>18} {'Notes':>20}") print("-" * 100) for pred in predictions: Z = pred['Z'] if Z > 99: # skip elements with no measured structure continue if Z not in KNOWN_STRUCTURES: continue sym = pred['sym'] block = pred['block'] period = pred['period'] d_pos = pred['d_pos'] base_arch = pred['base_arch'] final_arch = pred['final_arch'] corrected = pred['corrected'] # Cipher prediction in eigenvalue language pred_eig, pred_gap, pred_family = cipher_eigenvalue_prediction( Z, block, period, d_pos, base_arch, corrected, final_arch) # Actual structure eigenvalue count act_name, act_eig, act_gap, notes = KNOWN_STRUCTURES[Z] if act_eig == 0: # N/A na_count += 1 continue total_scored += 1 delta = abs(pred_eig - act_eig) if delta == 0: score = 'EXACT' match_exact += 1 elif delta <= 1: score = 'CLOSE(±1)' match_close += 1 elif delta <= 2: score = 'NEAR(±2)' miss += 0 # don't count as miss match_close += 1 # generous else: score = f'OFF({delta:+d})' miss += 1 # Print elements of interest if delta > 0 or corrected or block == 'd': print(f"{Z:3d} {sym:>4s} {pred_eig:8d} {act_eig:7d} {delta:3d} " f"{score:>8s} {final_arch:>10s} {act_name:>18s} {notes[:20]:>20s}") results.append({ 'Z': Z, 'sym': sym, 'pred_eig': pred_eig, 'act_eig': act_eig, 'delta': delta, 'score': score, 'pred_arch': final_arch, 'act_name': act_name, 'corrected': corrected, }) print() print("=" * 90) print("EIGENVALUE-NATIVE SUMMARY") print("=" * 90) print() print(f"Total scored: {total_scored}") print(f"Exact match (Δ=0): {match_exact}/{total_scored} = {match_exact/total_scored*100:.1f}%") print(f"Close (Δ≤1): {match_exact + match_close}/{total_scored} = {(match_exact+match_close)/total_scored*100:.1f}%") print(f"Miss (Δ>2): {miss}/{total_scored} = {miss/total_scored*100:.1f}%") print(f"N/A excluded: {na_count}") # Compare to label-based scoring print() print("COMPARISON: Eigenvalue scoring vs Label scoring") print("-" * 50) print(f" Label-based exact match: 69/96 = 71.9%") print(f" Eigenvalue exact match: {match_exact}/{total_scored} = {match_exact/total_scored*100:.1f}%") print(f" Eigenvalue close (±1): {match_exact+match_close}/{total_scored} = {(match_exact+match_close)/total_scored*100:.1f}%") # Identify where eigenvalue scoring DIFFERS from label scoring print() print("=" * 90) print("WHERE EIGENVALUE SCORING DIFFERS FROM LABEL SCORING") print("=" * 90) print() # Elements where label said MISS but eigenvalue says CLOSE label_misses_that_improve = [] # Elements where label said MATCH but eigenvalue says different label_matches_that_differ = [] for r in results: Z = r['Z'] # Check if this was a label miss if Z in [25, 49, 70, 89, 99]: # v9 label misses: Mn, In, Yb, Ac, Es if r['delta'] <= 2: label_misses_that_improve.append(r) print(f" IMPROVED: {r['sym']:>4s} (Z={Z}) — label=MISS, " f"eigenvalue Δ={r['delta']} ({r['pred_eig']} vs {r['act_eig']}) " f"= {'CLOSE' if r['delta'] <= 1 else 'NEAR'}") # Corrected elements — how do they score in eigenvalue language? if r['corrected']: print(f" CORRECTED: {r['sym']:>4s} (Z={Z}) — pred_eig={r['pred_eig']}, " f"act_eig={r['act_eig']}, Δ={r['delta']}") # Biggest remaining misses in eigenvalue language print() print("BIGGEST EIGENVALUE MISSES (Δ > 2):") for r in sorted(results, key=lambda x: -x['delta']): if r['delta'] > 2: print(f" {r['sym']:>4s} (Z={r['Z']}): pred={r['pred_eig']}, " f"actual={r['act_eig']}, Δ={r['delta']}, " f"pred_arch={r['pred_arch']}, actual={r['act_name']}")