#!/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}')