Spaces:
Runtime error
Runtime error
File size: 1,339 Bytes
6d3aa82 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/usr/bin/env python
"""Inter-Domain Fusion Test: Genesis of Domain [6] (Flip)"""
from logos.mtl.interpreter import MTLInterpreter
mtl = MTLInterpreter()
print('=== INTER-DOMAIN FUSION TEST (Genesis of [6]) ===')
# 1. Setup: Define the "Mechanism" (The Tool) in [2]
mtl.execute('(domain [2])')
mtl.execute('(store inverter (list -1 -1 -1))')
print('Domain [2] inverter:', mtl.execute('(fetch inverter)'))
# 2. Setup: Define the "Result" (The State) in [3]
mtl.execute('(domain [3])')
mtl.execute('(store static_state (list 10 20 30))')
print('Domain [3] static_state:', mtl.execute('(fetch static_state)'))
# 3. Execution: Cross-Domain Application
print('\nApplying Mechanism [2] to Result [3]...')
mtl.execute('(domain [6])') # Switch to Flip domain
# Perform the fusion using Hadamard product
mtl.execute('(store fused_state (mult (in-domain [2] (fetch inverter)) (in-domain [3] (fetch static_state))))')
# 4. Verification
print('Active Domain:', mtl.active_domain)
fused = mtl.execute('(fetch fused_state)')
print('Fused State (The Flip):', fused)
expected = [-10, -20, -30]
if fused == expected:
print('✅ FUSION VERIFIED: Mechanism × Result = Flip')
else:
print(f'❌ Expected {expected}, got {fused}')
# Show all domains
print('\n=== DOMAIN MAP ===')
for k, v in mtl.domains.items():
print(f' [{k}]: {v}')
|