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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SRC Algorithm Visualizer</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js"></script>
    <style>
        body {
            background: linear-gradient(135deg, #0f172a, #1e293b);
            color: #f1f5f9;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        .hilbert-space {
            background: rgba(15, 23, 42, 0.7);
            border: 1px solid #334155;
            box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
        }
        .prime-state {
            transition: all 0.5s ease;
        }
        .active-state {
            box-shadow: 0 0 15px #818cf8;
            transform: scale(1.1);
        }
        .resonance-path {
            stroke-dasharray: 1000;
            stroke-dashoffset: 1000;
        }
        .entropy-graph {
            background: rgba(30, 41, 59, 0.8);
        }
        .control-panel {
            background: rgba(15, 23, 42, 0.9);
            backdrop-filter: blur(10px);
        }
        .algorithm-step {
            transition: all 0.3s ease;
        }
        .current-step {
            background: rgba(99, 102, 241, 0.2);
            border-left: 3px solid #818cf8;
        }
    </style>
</head>
<body class="min-h-screen">
    <!-- Header -->
    <header class="py-6 px-4 sm:px-6 lg:px-8 border-b border-slate-700">
        <div class="max-w-7xl mx-auto flex flex-col md:flex-row justify-between items-center">
            <div>
                <h1 class="text-3xl font-bold text-indigo-300">Symbolic Resonance Collapse</h1>
                <p class="text-slate-400 mt-1">Visualization of P = NP Proof</p>
            </div>
            <div class="mt-4 md:mt-0 flex items-center space-x-4">
                <div class="bg-indigo-900/30 px-4 py-2 rounded-lg">
                    <span class="text-indigo-300 font-mono">P = NP</span>
                </div>
                <div class="text-sm text-slate-400">
                    Sebastian Schepis, 2025
                </div>
            </div>
        </div>
    </header>

    <!-- Main Content -->
    <main class="max-w-7xl mx-auto py-8 px-4 sm:px-6 lg:px-8">
        <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
            <!-- Visualization Panel -->
            <div class="lg:col-span-2">
                <div class="hilbert-space rounded-xl p-6">
                    <div class="flex justify-between items-center mb-6">
                        <h2 class="text-xl font-semibold text-indigo-200">Prime-Encoded Hilbert Space</h2>
                        <div class="flex space-x-2">
                            <button id="resetBtn" class="px-3 py-1 bg-slate-700 hover:bg-slate-600 rounded-lg text-sm">
                                Reset
                            </button>
                            <button id="startBtn" class="px-3 py-1 bg-indigo-600 hover:bg-indigo-500 rounded-lg text-sm">
                                Start Simulation
                            </button>
                        </div>
                    </div>
                    
                    <!-- Hilbert Space Visualization -->
                    <div class="relative h-96 rounded-lg border border-slate-600 bg-slate-900/50 overflow-hidden">
                        <div id="hilbertCanvas" class="w-full h-full relative">
                            <!-- Prime states will be dynamically added here -->
                        </div>
                        
                        <!-- Resonance path -->
                        <svg class="absolute top-0 left-0 w-full h-full pointer-events-none">
                            <path id="resonancePath" class="resonance-path" fill="none" stroke="#818cf8" stroke-width="2"></path>
                        </svg>
                    </div>
                    
                    <!-- System Status -->
                    <div class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-4">
                        <div class="bg-slate-800/50 p-4 rounded-lg">
                            <div class="text-sm text-slate-400">Current State</div>
                            <div id="currentState" class="text-lg font-mono text-indigo-300">|Ψ₀⟩</div>
                        </div>
                        <div class="bg-slate-800/50 p-4 rounded-lg">
                            <div class="text-sm text-slate-400">Entropy</div>
                            <div id="entropyValue" class="text-lg font-mono text-green-300">S₀</div>
                        </div>
                        <div class="bg-slate-800/50 p-4 rounded-lg">
                            <div class="text-sm text-slate-400">Time Step</div>
                            <div id="timeStep" class="text-lg font-mono text-yellow-300">t = 0</div>
                        </div>
                    </div>
                </div>
                
                <!-- Entropy Graph -->
                <div class="hilbert-space rounded-xl p-6 mt-8">
                    <h2 class="text-xl font-semibold text-indigo-200 mb-4">Entropy Convergence</h2>
                    <div class="entropy-graph rounded-lg p-4 h-64">
                        <canvas id="entropyChart" width="800" height="200"></canvas>
                    </div>
                </div>
            </div>
            
            <!-- Control Panel -->
            <div class="control-panel rounded-xl p-6 h-fit">
                <h2 class="text-xl font-semibold text-indigo-200 mb-4">Algorithm Steps</h2>
                
                <div class="space-y-4">
                    <div class="algorithm-step p-4 rounded-lg current-step" data-step="0">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-6 w-6 rounded-full bg-indigo-500 flex items-center justify-center text-xs font-bold">1</div>
                            <div class="ml-3">
                                <h3 class="font-medium text-white">Prime-Encoded Hilbert Space</h3>
                                <p class="mt-1 text-sm text-slate-400">Define HP over prime-number eigenstates |p⟩ for Boolean variables</p>
                            </div>
                        </div>
                    </div>
                    
                    <div class="algorithm-step p-4 rounded-lg" data-step="1">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-6 w-6 rounded-full bg-slate-700 flex items-center justify-center text-xs font-bold">2</div>
                            <div class="ml-3">
                                <h3 class="font-medium text-white">SAT Representation</h3>
                                <p class="mt-1 text-sm text-slate-400">Encode SAT instance Φ into symbolic state |Ψ₀⟩ ∈ H⊗nP</p>
                            </div>
                        </div>
                    </div>
                    
                    <div class="algorithm-step p-4 rounded-lg" data-step="2">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-6 w-6 rounded-full bg-slate-700 flex items-center justify-center text-xs font-bold">3</div>
                            <div class="ml-3">
                                <h3 class="font-medium text-white">Symbolic Operators</h3>
                                <p class="mt-1 text-sm text-slate-400">Define Hamiltonian ĤΦ and Resonance Operator R̂</p>
                            </div>
                        </div>
                    </div>
                    
                    <div class="algorithm-step p-4 rounded-lg" data-step="3">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-6 w-6 rounded-full bg-slate-700 flex items-center justify-center text-xs font-bold">4</div>
                            <div class="ml-3">
                                <h3 class="font-medium text-white">System Evolution</h3>
                                <p class="mt-1 text-sm text-slate-400">Evolve |Ψ(t)⟩ using symbolic Schrödinger equation</p>
                            </div>
                        </div>
                    </div>
                    
                    <div class="algorithm-step p-4 rounded-lg" data-step="4">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-6 w-6 rounded-full bg-slate-700 flex items-center justify-center text-xs font-bold">5</div>
                            <div class="ml-3">
                                <h3 class="font-medium text-white">Entropy Minimization</h3>
                                <p class="mt-1 text-sm text-slate-400">S(t) decreases as system approaches stable state</p>
                            </div>
                        </div>
                    </div>
                    
                    <div class="algorithm-step p-4 rounded-lg" data-step="5">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-6 w-6 rounded-full bg-slate-700 flex items-center justify-center text-xs font-bold">6</div>
                            <div class="ml-3">
                                <h3 class="font-medium text-white">Polynomial Convergence</h3>
                                <p class="mt-1 text-sm text-slate-400">System reaches |Ψ*⟩ in O(nᵏ) symbolic time</p>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Parameters -->
                <div class="mt-8">
                    <h3 class="font-medium text-white mb-3">Simulation Parameters</h3>
                    <div class="space-y-4">
                        <div>
                            <label class="block text-sm text-slate-400 mb-1">Variables (n)</label>
                            <input type="range" min="3" max="10" value="5" id="varCount" class="w-full">
                            <div class="text-right text-sm text-slate-400" id="varCountValue">5</div>
                        </div>
                        <div>
                            <label class="block text-sm text-slate-400 mb-1">Clauses (m)</label>
                            <input type="range" min="3" max="15" value="7" id="clauseCount" class="w-full">
                            <div class="text-right text-sm text-slate-400" id="clauseCountValue">7</div>
                        </div>
                        <div>
                            <label class="block text-sm text-slate-400 mb-1">Decay Constant (λ)</label>
                            <input type="range" min="0.1" max="2" step="0.1" value="0.5" id="decayConstant" class="w-full">
                            <div class="text-right text-sm text-slate-400" id="decayValue">0.5</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- Explanation Section -->
        <div class="mt-12 hilbert-space rounded-xl p-8">
            <h2 class="text-2xl font-bold text-indigo-200 mb-6">How Symbolic Resonance Collapse Works</h2>
            
            <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                <div>
                    <h3 class="text-lg font-semibold text-white mb-3">The Framework</h3>
                    <p class="text-slate-300 mb-4">
                        The SRC framework redefines computation as an entropic resonance process in a quantum-inspired 
                        Hilbert space over prime-number eigenstates. Instead of combinatorial search, NP-complete problems 
                        converge to solution states through entropy-driven alignment.
                    </p>
                    <p class="text-slate-300">
                        SAT instances are modeled as symbolic wavefunctions undergoing entropy minimization, with clause 
                        interactions acting as quantum-like operators in a resonance field.
                    </p>
                </div>
                
                <div>
                    <h3 class="text-lg font-semibold text-white mb-3">Key Insights</h3>
                    <ul class="space-y-2 text-slate-300">
                        <li class="flex items-start">
                            <i data-feather="check-circle" class="text-green-400 mt-1 mr-2 flex-shrink-0"></i>
                            <span>Computation as coherence alignment rather than enumeration</span>
                        </li>
                        <li class="flex items-start">
                            <i data-feather="check-circle" class="text-green-400 mt-1 mr-2 flex-shrink-0"></i>
                            <span>Polynomial convergence through symbolic gradient descent</span>
                        </li>
                        <li class="flex items-start">
                            <i data-feather="check-circle" class="text-green-400 mt-1 mr-2 flex-shrink-0"></i>
                            <span>Entropy minimization drives system to stable states</span>
                        </li>
                        <li class="flex items-start">
                            <i data-feather="check-circle" class="text-green-400 mt-1 mr-2 flex-shrink-0"></i>
                            <span>No local minima for satisfiable instances</span>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </main>

    <script>
        // Initialize Feather Icons
        feather.replace();
        
        // DOM Elements
        const hilbertCanvas = document.getElementById('hilbertCanvas');
        const entropyChart = document.getElementById('entropyChart').getContext('2d');
        const currentStateEl = document.getElementById('currentState');
        const entropyValueEl = document.getElementById('entropyValue');
        const timeStepEl = document.getElementById('timeStep');
        const startBtn = document.getElementById('startBtn');
        const resetBtn = document.getElementById('resetBtn');
        const varCount = document.getElementById('varCount');
        const clauseCount = document.getElementById('clauseCount');
        const decayConstant = document.getElementById('decayConstant');
        const varCountValue = document.getElementById('varCountValue');
        const clauseCountValue = document.getElementById('clauseCountValue');
        const decayValue = document.getElementById('decayValue');
        const algorithmSteps = document.querySelectorAll('.algorithm-step');
        
        // Simulation state
        let simulationRunning = false;
        let currentTime = 0;
        let entropyData = [];
        let currentState = '|Ψ₀⟩';
        let primeStates = [];
        let animationTimeline = null;
        
        // Update parameter displays
        varCount.addEventListener('input', () => {
            varCountValue.textContent = varCount.value;
        });
        
        clauseCount.addEventListener('input', () => {
            clauseCountValue.textContent = clauseCount.value;
        });
        
        decayConstant.addEventListener('input', () => {
            decayValue.textContent = decayConstant.value;
        });
        
        // Initialize visualization
        function initVisualization() {
            hilbertCanvas.innerHTML = '';
            primeStates = [];
            
            // Create prime-number eigenstates
            const primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29];
            const n = parseInt(varCount.value);
            
            for (let i = 0; i < n; i++) {
                const prime = primes[i];
                const state = document.createElement('div');
                state.className = 'prime-state absolute w-16 h-16 rounded-full flex items-center justify-center text-white font-bold border-2 border-indigo-400';
                state.style.left = `${20 + (i % 3) * 30}%`;
                state.style.top = `${20 + Math.floor(i / 3) * 30}%`;
                state.style.backgroundColor = `rgba(${50 + i * 20}, ${60 + i * 15}, ${200 + i * 5}, 0.7)`;
                state.textContent = `|${prime}⟩`;
                state.dataset.prime = prime;
                state.dataset.index = i;
                
                hilbertCanvas.appendChild(state);
                primeStates.push(state);
            }
            
            // Reset state displays
            currentStateEl.textContent = '|Ψ₀⟩';
            entropyValueEl.textContent = 'S₀';
            timeStepEl.textContent = 't = 0';
            entropyData = [{time: 0, entropy: 100}];
            drawEntropyChart();
        }
        
        // Draw entropy convergence chart
        function drawEntropyChart() {
            entropyChart.clearRect(0, 0, entropyChart.canvas.width, entropyChart.canvas.height);
            
            if (entropyData.length === 0) return;
            
            // Draw grid
            entropyChart.strokeStyle = '#334155';
            entropyChart.lineWidth = 1;
            
            // Vertical grid lines
            for (let i = 0; i <= 10; i++) {
                const x = (i / 10) * entropyChart.canvas.width;
                entropyChart.beginPath();
                entropyChart.moveTo(x, 0);
                entropyChart.lineTo(x, entropyChart.canvas.height);
                entropyChart.stroke();
            }
            
            // Horizontal grid lines
            for (let i = 0; i <= 5; i++) {
                const y = (i / 5) * entropyChart.canvas.height;
                entropyChart.beginPath();
                entropyChart.moveTo(0, y);
                entropyChart.lineTo(entropyChart.canvas.width, y);
                entropyChart.stroke();
            }
            
            // Draw entropy curve
            entropyChart.strokeStyle = '#4ade80';
            entropyChart.lineWidth = 3;
            entropyChart.beginPath();
            
            for (let i = 0; i < entropyData.length; i++) {
                const x = (entropyData[i].time / 100) * entropyChart.canvas.width;
                const y = entropyChart.canvas.height - (entropyData[i].entropy / 100) * entropyChart.canvas.height;
                
                if (i === 0) {
                    entropyChart.moveTo(x, y);
                } else {
                    entropyChart.lineTo(x, y);
                }
            }
            
            entropyChart.stroke();
        }
        
        // Animate the simulation
        function animateSimulation() {
            if (!simulationRunning) return;
            
            currentTime++;
            timeStepEl.textContent = `t = ${currentTime}`;
            
            // Update entropy
            const newEntropy = Math.max(0, 100 - currentTime * 5);
            entropyValueEl.textContent = `S(t) = ${newEntropy.toFixed(1)}`;
            entropyData.push({time: currentTime, entropy: newEntropy});
            drawEntropyChart();
            
            // Animate prime states
            primeStates.forEach((state, index) => {
                // Simulate phase changes
                const phase = (currentTime + index) % 4;
                const phases = ['0', 'π/2', 'π', '3π/2'];
                
                // Update visual state
                anime({
                    targets: state,
                    scale: [1, 1.1, 1],
                    backgroundColor: [
                        state.style.backgroundColor,
                        `rgba(${100 + index * 15}, ${120 + index * 10}, ${220 + index * 5}, 0.9)`,
                        state.style.backgroundColor
                    ],
                    duration: 1000,
                    easing: 'easeInOutQuad'
                });
                
                // Add active class temporarily
                state.classList.add('active-state');
                setTimeout(() => {
                    state.classList.remove('active-state');
                }, 1000);
            });
            
            // Update current state
            if (currentTime < 10) {
                currentStateEl.textContent = '|Ψ(t)⟩';
            } else if (currentTime < 20) {
                currentStateEl.textContent = '|Ψ*⟩';
                // Highlight final step
                algorithmSteps.forEach(step => step.classList.remove('current-step'));
                algorithmSteps[5].classList.add('current-step');
            }
            
            // Update algorithm steps
            if (currentTime >= 5 && currentTime < 10) {
                algorithmSteps.forEach(step => step.classList.remove('current-step'));
                algorithmSteps[3].classList.add('current-step');
            } else if (currentTime >= 10 && currentTime < 15) {
                algorithmSteps.forEach(step => step.classList.remove('current-step'));
                algorithmSteps[4].classList.add('current-step');
            }
            
            // Continue animation or stop
            if (currentTime < 25) {
                setTimeout(animateSimulation, 800);
            } else {
                simulationRunning = false;
                startBtn.textContent = 'Restart Simulation';
            }
        }
        
        // Event Listeners
        startBtn.addEventListener('click', () => {
            if (!simulationRunning) {
                simulationRunning = true;
                startBtn.textContent = 'Running...';
                animateSimulation();
            }
        });
        
        resetBtn.addEventListener('click', () => {
            simulationRunning = false;
            currentTime = 0;
            startBtn.textContent = 'Start Simulation';
            initVisualization();
            
            // Reset algorithm steps
            algorithmSteps.forEach(step => step.classList.remove('current-step'));
            algorithmSteps[0].classList.add('current-step');
        });
        
        // Initialize on load
        window.addEventListener('load', () => {
            initVisualization();
            
            // Animate introduction
            anime({
                targets: '.prime-state',
                scale: [0, 1],
                opacity: [0, 1],
                delay: anime.stagger(200),
                duration: 1000,
                easing: 'easeOutElastic'
            });
        });
    </script>
</body>
</html>