File size: 50,211 Bytes
7d62eb1
 
 
 
 
ea831bf
7d62eb1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ea831bf
7d62eb1
ea831bf
7d62eb1
 
ea831bf
7d62eb1
 
 
 
 
 
 
 
 
 
 
 
ea831bf
 
7d62eb1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ea831bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d62eb1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ea831bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d62eb1
 
 
 
 
 
 
 
5c511b9
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
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
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>ATON QAI — Research Interactive Atlas (17 Verified Studies · v1.6.0)</title>
  <style>
    :root {
      --bg: #070b14;
      --panel: #0f172a;
      --panel-alt: #131e36;
      --border: #263554;
      --gold: #eab308;
      --gold-soft: #fde047;
      --cyan: #38bdf8;
      --emerald: #34d399;
      --rose: #fb7185;
      --text: #f8fafc;
      --muted: #94a3b8;
      --mono: "JetBrains Mono", "Consolas", monospace;
      --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      padding: 20px;
      background: radial-gradient(circle at top right, #172554 0%, var(--bg) 60%);
      color: var(--text);
      font-family: var(--sans);
      line-height: 1.5;
    }
    .container { max-width: 1280px; margin: 0 auto; }
    .header {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      gap: 16px;
      padding: 20px 24px;
      background: rgba(15, 23, 42, 0.9);
      border: 1px solid var(--border);
      border-top: 3px solid var(--gold);
      border-radius: 12px;
      margin-bottom: 18px;
    }
    .brand-eyebrow {
      font-family: var(--mono);
      font-size: 11px;
      letter-spacing: 1.6px;
      text-transform: uppercase;
      color: var(--gold);
      margin-bottom: 4px;
    }
    h1 { margin: 0; font-size: 23px; font-weight: 700; }
    .subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
    .nav-pills { display: flex; gap: 8px; flex-wrap: wrap; }
    .pill {
      display: inline-block;
      padding: 6px 12px;
      border-radius: 999px;
      font-size: 12px;
      font-family: var(--mono);
      text-decoration: none;
      color: var(--gold-soft);
      background: rgba(234, 179, 8, 0.12);
      border: 1px solid rgba(234, 179, 8, 0.35);
    }
    .pill:hover { background: rgba(234, 179, 8, 0.22); }
    .tabs {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 18px;
    }
    .tab-btn {
      padding: 10px 14px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--panel);
      color: var(--muted);
      font-family: var(--mono);
      font-size: 12px;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .tab-btn:hover { color: var(--text); border-color: #3b4f7a; }
    .tab-btn.active {
      background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(56, 189, 248, 0.15));
      color: var(--gold-soft);
      border-color: var(--gold);
      font-weight: 600;
    }
    .tab-panel { display: none; }
    .tab-panel.active { display: block; }
    .grid {
      display: grid;
      grid-template-columns: 370px 1fr;
      gap: 18px;
    }
    @media (max-width: 980px) { .grid { grid-template-columns: 1fr; } }
    .card {
      background: rgba(15, 23, 42, 0.92);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 18px;
    }
    .card h2 {
      margin: 0 0 12px;
      font-size: 15px;
      text-transform: uppercase;
      letter-spacing: 0.8px;
      color: var(--gold-soft);
      font-family: var(--mono);
    }
    label {
      display: flex;
      justify-content: space-between;
      font-size: 12.5px;
      color: #cbd5e1;
      margin-bottom: 4px;
      margin-top: 12px;
    }
    label span.val { font-family: var(--mono); color: var(--gold-soft); }
    select, input[type="range"] { width: 100%; }
    select {
      padding: 9px 10px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--panel-alt);
      color: var(--text);
      font-size: 13px;
    }
    input[type="range"] { accent-color: var(--gold); cursor: pointer; }
    .kpi-row {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 10px;
      margin-bottom: 14px;
    }
    @media (max-width: 720px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
    .kpi {
      background: var(--panel-alt);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 10px 12px;
    }
    .kpi .k-label { font-size: 11px; color: var(--muted); text-transform: uppercase; font-family: var(--mono); }
    .kpi .k-val { font-size: 18px; font-weight: 700; font-family: var(--mono); color: var(--gold-soft); margin-top: 3px; }
    .svg-box {
      background: #090e1a;
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px;
      margin-bottom: 14px;
    }
    pre {
      margin: 0;
      padding: 12px;
      background: #060a12;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-family: var(--mono);
      font-size: 12px;
      color: #e2e8f0;
      overflow-x: auto;
      white-space: pre-wrap;
    }
    table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
    th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
    th { color: var(--gold-soft); font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; }
    td.mono { font-family: var(--mono); }
    .paper-link {
      display: inline-block;
      margin-top: 10px;
      color: var(--cyan);
      font-family: var(--mono);
      font-size: 12px;
      text-decoration: none;
    }
    .paper-link:hover { text-decoration: underline; }
  </style>
</head>
<body>
  <div class="container">
    <header class="header">
      <div>
        <div class="brand-eyebrow">ATON QAI · VERIFIED SCIENTIFIC RESEARCH ATLAS (17 STUDIES · v1.6.0)</div>
        <h1>Interactive Visualizations for ATON QAI Research Publications</h1>
        <p class="subtitle">Explore live mathematical models, empirical datasets, .qai 1.0 / .qai 1.1 reference circuits, and SHA-256 verification receipts from https://aton-qai.ai/research/</p>
      </div>
      <div class="nav-pills">
        <a class="pill" href="https://aton-qai.ai/research/" target="_blank" rel="noopener">📚 Research Portal (17 Papers)</a>
        <a class="pill" href="https://huggingface.co/spaces/ATON-QAI/QAI-Photonic-Workbench" target="_blank" rel="noopener">🔬 Photonic Workbench</a>
        <a class="pill" href="https://huggingface.co/datasets/ATON-QAI/QAI-Research-Articles-and-Metrics" target="_blank" rel="noopener">📊 Research Dataset</a>
      </div>
    </header>

    <div class="tabs" role="tablist">
      <button class="tab-btn active" onclick="switchTab(0)">01 · Adaptive MZI Control (EWMA vs MLP)</button>
      <button class="tab-btn" onclick="switchTab(1)">02/06 · Formal Verification &amp; Fenced Runtime</button>
      <button class="tab-btn" onclick="switchTab(2)">03 · .qai 1.0 DSL &amp; Dual-Rail Sign Duality</button>
      <button class="tab-btn" onclick="switchTab(3)">04 · Rational Gram &amp; Bargmann Triads</button>
      <button class="tab-btn" onclick="switchTab(4)">05/08 · Digital Twins, Passports &amp; 42-Paper Audit</button>
      <button class="tab-btn" onclick="switchTab(5)">07 · Bosonic Network Capacity &amp; Quantum Switch</button>
      <button class="tab-btn" onclick="switchTab(6)">09–11 · Physical QPUs (48,600 Shots) &amp; SNSPD Passport v2</button>
      <button class="tab-btn" onclick="switchTab(7)">12–17 · Boson Entropy, RTX 4080 ModelLab &amp; OCI Proofs</button>
    </div>

    <!-- TAB 0: PAPER 01 MZI CONTROL -->
    <section class="tab-panel active" id="tab-0">
      <div class="grid">
        <div class="card">
          <h2>Paper 01 · MZI Drift &amp; Loss Controls</h2>
          <label for="mzi-regime">Perturbation Regime (61,440 Frames)</label>
          <select id="mzi-regime" onchange="renderMziTab()">
            <option value="nominal">1. Nominal Drift (32 episodes)</option>
            <option value="fast_drift">2. Fast Random-Walk Drift (32 episodes)</option>
            <option value="phase_jump">3. Discontinuous Phase Jump (32 episodes)</option>
            <option value="high_loss">4. High Optical Loss (32 episodes)</option>
            <option value="telemetry_dropout">5. Telemetry Dropout (32 episodes)</option>
            <option value="delayed_actuation">6. Delayed Actuation (32 episodes)</option>
          </select>
          <label for="ewma-alpha">EWMA Smoothing Factor α <span class="val" id="ewma-alpha-val">0.25</span></label>
          <input type="range" id="ewma-alpha" min="0.05" max="0.80" step="0.05" value="0.25" oninput="renderMziTab()" />
          <p style="font-size:12.5px;color:var(--muted);margin-top:12px;">
            Blind equal-probe-budget audit (<code>8,192</code> probe photons/episode) across <code>192</code> episodes showing a lightweight EWMA finite-difference filter matching or outperforming a 3-seed MLP neural controller in every regime while running in <code>12.2 μs</code> vs. <code>20.0 μs</code>.
          </p>
          <pre>qai 1.0;
profile photonic.dv.linear;
experiment mzi_adaptive_probe(theta: angle = pi / 3) {
    let m: modes&lt;2, fock&gt; = prepare fock [1, 0];
    split(m[0], m[1]) reflectivity 1 / 2;
    phase m[0] by theta;
    split(m[0], m[1]) reflectivity 1 / 2;
    let c: tuple&lt;count, count&gt; = measure pnr m;
    emit c;
}</pre>
          <a class="paper-link" href="https://aton-qai.ai/research/p-ctrl-01-adaptive-mzi-control" target="_blank" rel="noopener">↗ Read full Paper 01 on aton-qai.ai/research</a>
        </div>
        <div class="card">
          <h2>Empirical Comparison Across All 6 Regimes (EWMA vs. 3-Seed MLP vs. Static)</h2>
          <div class="kpi-row">
            <div class="kpi"><div class="k-label">EWMA Detection</div><div class="k-val" id="mzi-k-ewma">74.16%</div></div>
            <div class="kpi"><div class="k-label">3-Seed MLP Detection</div><div class="k-val" id="mzi-k-mlp">73.64%</div></div>
            <div class="kpi"><div class="k-label">EWMA vs MLP RMSE</div><div class="k-val" id="mzi-k-rmse">0.061 vs 0.175r</div></div>
            <div class="kpi"><div class="k-label">Median Latency</div><div class="k-val">12.2 vs 20.0 μs</div></div>
          </div>
          <div class="svg-box" id="mzi-svg-box"></div>
        </div>
      </div>
    </section>

    <!-- TAB 1: PAPERS 02 & 06 FORMAL VERIFICATION & RUNTIME -->
    <section class="tab-panel" id="tab-1">
      <div class="grid">
        <div class="card">
          <h2>Papers 02 &amp; 06 · Verification Tier Selector</h2>
          <label for="fv-tier">Inspect Verification Layer</label>
          <select id="fv-tier" onchange="renderFvTab()">
            <option value="all">All 4 Verification Tiers (70 Obligations)</option>
            <option value="lean">Tier 1 · Lean 4.34.1 Mechanized Theorems (8/8, 0 sorry)</option>
            <option value="smt">Tier 2 · Z3 SMT 5.1.0 Refutation Contracts (5/5 UNSAT)</option>
            <option value="tla">Tier 3 · TLC 2.19 TLA+ Distributed Specs (9/9, 0 errors)</option>
            <option value="runtime">Fenced Distributed Runtime &amp; mTLS Loopback (128/128)</option>
          </select>
          <p style="font-size:12.5px;color:var(--muted);margin-top:12px;">
            Mechanized proofs guarantee algebraic Fock-number conservation, compiler lowering equivalence, monotonic epoch lease fencing (<code>epoch_new &gt; epoch_old</code>), pre-RUNNING SHA-256 worker quarantine, and exact Decimal monetary reserve conservation.
          </p>
          <pre>qai 1.0;
profile photonic.dv.linear;
experiment fv_photon_conservation() {
    let m: modes&lt;2, fock&gt; = prepare fock [1, 1];
    split(m[0], m[1]) reflectivity 1 / 2;
    let c: tuple&lt;count, count&gt; = measure pnr m;
    emit c;
}</pre>
          <a class="paper-link" href="https://aton-qai.ai/research/gate-fv-formal-verification" target="_blank" rel="noopener">↗ Read Paper 02 (Formal Verification)</a><br/>
          <a class="paper-link" href="https://aton-qai.ai/research/c08-c16-fenced-distributed-runtime" target="_blank" rel="noopener">↗ Read Paper 06 (Fenced Distributed Runtime)</a>
        </div>
        <div class="card">
          <h2>Three-Tier Mechanized Proof &amp; Distributed Runtime Matrix</h2>
          <div class="kpi-row">
            <div class="kpi"><div class="k-label">Lean 4.34.1</div><div class="k-val">8 / 8 (0 sorry)</div></div>
            <div class="kpi"><div class="k-label">Z3 5.1.0 SMT</div><div class="k-val">5 / 5 UNSAT</div></div>
            <div class="kpi"><div class="k-label">TLC 2.19 TLA+</div><div class="k-val">9 / 9 (0 err)</div></div>
            <div class="kpi"><div class="k-label">mTLS 1.3 Loopback</div><div class="k-val">128 / 128 PASS</div></div>
          </div>
          <div class="svg-box" id="fv-svg-box"></div>
          <div id="fv-table-box"></div>
        </div>
      </div>
    </section>

    <!-- TAB 2: PAPER 03 .QAI 1.0 & SIGN DUALITY -->
    <section class="tab-panel" id="tab-2">
      <div class="grid">
        <div class="card">
          <h2>Paper 03 · Dual-Rail Sign Duality &amp; Fock Guard</h2>
          <label for="duality-theta">Interferometer Phase Angle θ / π <span class="val" id="duality-theta-val">0.333 π (60.0°)</span></label>
          <input type="range" id="duality-theta" min="0" max="1" step="0.01" value="0.3333" oninput="renderDualityTab()" />
          <label for="fock-modes">Optical Modes m <span class="val" id="fock-modes-val">8</span></label>
          <input type="range" id="fock-modes" min="2" max="24" step="1" value="8" oninput="renderDualityTab()" />
          <label for="fock-photons">Total Photons n <span class="val" id="fock-photons-val">4</span></label>
          <input type="range" id="fock-photons" min="1" max="12" step="1" value="4" oninput="renderDualityTab()" />
          <p style="font-size:12.5px;color:var(--muted);margin-top:12px;">
            Photonic dual-rail observable <code>&lt;Z_L&gt; = P(0,1) - P(1,0) = -cos(θ)</code> has derivative <code>+sin(θ)</code>, whereas OpenQASM 3.0 <code>&lt;Z&gt; = +cos(θ)</code> has derivative <code>-sin(θ)</code>. Without explicit sign-duality reconciliation, hybrid VQE optimizers invert gradient descent into ascent.
          </p>
          <a class="paper-link" href="https://aton-qai.ai/research/l01-l05-qai-language-and-gl-r-08" target="_blank" rel="noopener">↗ Read full Paper 03 on aton-qai.ai/research</a>
        </div>
        <div class="card">
          <h2>Live Observable Expectation &amp; Parameter-Shift Derivative Curves</h2>
          <div class="kpi-row">
            <div class="kpi"><div class="k-label">Photonic &lt;Z_L(θ)&gt;</div><div class="k-val" id="dual-k-zl">-0.5000</div></div>
            <div class="kpi"><div class="k-label">OpenQASM &lt;Z(θ)&gt;</div><div class="k-val" id="dual-k-zq">+0.5000</div></div>
            <div class="kpi"><div class="k-label">d&lt;Z_L&gt;/dθ vs d&lt;Z&gt;/dθ</div><div class="k-val" id="dual-k-grad">+0.866 vs -0.866</div></div>
            <div class="kpi"><div class="k-label">Fock dim C(m+n-1,n)</div><div class="k-val" id="dual-k-dim">330 (OK)</div></div>
          </div>
          <div class="svg-box" id="duality-svg-box"></div>
        </div>
      </div>
    </section>

    <!-- TAB 3: PAPER 04 BARGMANN TRIADS & GRAM MATRICES -->
    <section class="tab-panel" id="tab-3">
      <div class="grid">
        <div class="card">
          <h2>Paper 04 · Exact Rational Gram &amp; Bargmann Triad</h2>
          <label for="barg-r">Pairwise Overlap Modulus r = |S_ij| <span class="val" id="barg-r-val">0.95</span></label>
          <input type="range" id="barg-r" min="0.10" max="1.00" step="0.01" value="0.95" oninput="renderBargmannTab()" />
          <label for="barg-phi">Collective Bargmann Triad Phase φ / π <span class="val" id="barg-phi-val">0.00 π</span></label>
          <input type="range" id="barg-phi" min="0.00" max="1.00" step="0.02" value="0.00" oninput="renderBargmannTab()" />
          <label for="barg-eta">Channel Transmittance η <span class="val" id="barg-eta-val">0.90</span></label>
          <input type="range" id="barg-eta" min="0.40" max="1.00" step="0.02" value="0.90" oninput="renderBargmannTab()" />
          <p style="font-size:12.5px;color:var(--muted);margin-top:12px;">
            Even when all pairwise HOM visibilities <code>V = r²</code> are held constant, varying the collective 3-photon Bargmann phase <code>φ = arg(S_12 S_23 S_31)</code> modulates the tritter coincidence probability <code>P(1,1,1) = (1 + 2 r³ cos φ)/9</code> and the 3×3 Gram principal minor <code>det(S) = 1 - 3r² + 2r³ cos φ</code>.
          </p>
          <a class="paper-link" href="https://aton-qai.ai/research/p01-p06-exact-rational-gram-bargmann" target="_blank" rel="noopener">↗ Read full Paper 04 on aton-qai.ai/research</a>
        </div>
        <div class="card">
          <h2>HOM Coincidence Dip &amp; 3-Photon Bargmann Phase Modulation</h2>
          <div class="kpi-row">
            <div class="kpi"><div class="k-label">Pairwise HOM V = r²</div><div class="k-val" id="barg-k-v">0.9025</div></div>
            <div class="kpi"><div class="k-label">HOM P_pre(1,1)</div><div class="k-val" id="barg-k-hom">0.0488</div></div>
            <div class="kpi"><div class="k-label">Tritter P(1,1,1)</div><div class="k-val" id="barg-k-p111">0.3016</div></div>
            <div class="kpi"><div class="k-label">3×3 Gram Minor det(S)</div><div class="k-val" id="barg-k-det">+0.0073 (PSD)</div></div>
          </div>
          <div class="svg-box" id="bargmann-svg-box"></div>
        </div>
      </div>
    </section>

    <!-- TAB 4: PAPERS 05 & 08 DIGITAL TWINS & 42-PAPER AUDIT -->
    <section class="tab-panel" id="tab-4">
      <div class="grid">
        <div class="card">
          <h2>Papers 05 &amp; 08 · Loss Denominator &amp; Twin Audit</h2>
          <label for="loss-photons">Multi-Photon Coincidence Order n <span class="val" id="loss-photons-val">4 photons</span></label>
          <input type="range" id="loss-photons" min="1" max="8" step="1" value="4" oninput="renderTwinTab()" />
          <label for="loss-lens">1st Collection Lens Efficiency <span class="val" id="loss-lens-val">37.0%</span></label>
          <input type="range" id="loss-lens" min="10" max="80" step="1" value="37" oninput="renderTwinTab()" />
          <label for="loss-smf">Single-Mode Fiber (SMF) Coupled Efficiency <span class="val" id="loss-smf-val">13.0%</span></label>
          <input type="range" id="loss-smf" min="2" max="50" step="1" value="13" oninput="renderTwinTab()" />
          <p style="font-size:12.5px;color:var(--muted);margin-top:12px;">
            Auditing <code>42</code> contemporary photonics papers revealed routine conflation of first-lens collection (<code>37%</code>) with SMF-coupled efficiency (<code>13%</code>), inflating n-photon scaling claims by <code>(0.37/0.13)^n</code>. Passports also strictly separate Cloud Digital-Twin Emulators from physical QPUs.
          </p>
          <a class="paper-link" href="https://aton-qai.ai/research/c14a-cloud-twins-and-qpu-passports" target="_blank" rel="noopener">↗ Read Paper 05 (Digital Twins &amp; Passports)</a><br/>
          <a class="paper-link" href="https://aton-qai.ai/research/mon-42-photonics-meta-analysis" target="_blank" rel="noopener">↗ Read Paper 08 (42-Paper Photonics Meta-Analysis)</a>
        </div>
        <div class="card">
          <h2>Source-to-Coincidence Loss Cascade &amp; Cloud Qualification Regimes</h2>
          <div class="kpi-row">
            <div class="kpi"><div class="k-label">n-Photon Lens Yield</div><div class="k-val" id="twin-k-lens">1.874%</div></div>
            <div class="kpi"><div class="k-label">n-Photon SMF Yield</div><div class="k-val" id="twin-k-smf">0.0286%</div></div>
            <div class="kpi"><div class="k-label">Inflation Factor</div><div class="k-val" id="twin-k-inf">65.6×</div></div>
            <div class="kpi"><div class="k-label">EMU-ASCELLA HOM V</div><div class="k-val">0.9963 (TVD 0.0156)</div></div>
          </div>
          <div class="svg-box" id="twin-svg-box"></div>
        </div>
      </div>
    </section>

    <!-- TAB 5: PAPER 07 BOSONIC CAPACITY & QUANTUM SWITCH -->
    <section class="tab-panel" id="tab-5">
      <div class="grid">
        <div class="card">
          <h2>Paper 07 · Bosonic Capacity &amp; Quantum Switch</h2>
          <label for="net-len">Optical Fiber Link Length L (km) <span class="val" id="net-len-val">15.0 km</span></label>
          <input type="range" id="net-len" min="1" max="80" step="1" value="15" oninput="renderNetTab()" />
          <label for="net-att">Fiber Attenuation α (dB/km) <span class="val" id="net-att-val">0.20 dB/km</span></label>
          <input type="range" id="net-att" min="0.10" max="0.50" step="0.02" value="0.20" oninput="renderNetTab()" />
          <label for="net-n">Mean Photon Number per Mode N <span class="val" id="net-n-val">1.00</span></label>
          <input type="range" id="net-n" min="0.10" max="5.00" step="0.10" value="1.00" oninput="renderNetTab()" />
          <label for="net-nodes">Path-Graph Network Nodes n <span class="val" id="net-nodes-val">20 nodes</span></label>
          <input type="range" id="net-nodes" min="4" max="32" step="2" value="20" oninput="renderNetTab()" />
          <p style="font-size:12.5px;color:var(--muted);margin-top:12px;">
            Computes exact pure-loss bosonic capacity <code>C(η, N) = g(N) - g((1-η)N)</code> bits/mode where <code>g(x) = (x+1)log₂(x+1) - x log₂(x)</code>, and compares sequential <code>Piecemaker</code> persistent memory <code>⌊n/2⌋</code> qubits against the <code>1-qubit</code> Quantum Switch lower bound.
          </p>
          <a class="paper-link" href="https://aton-qai.ai/research/s15-04-domain-irs-and-quantum-switch" target="_blank" rel="noopener">↗ Read full Paper 07 on aton-qai.ai/research</a>
        </div>
        <div class="card">
          <h2>Pure-Loss Bosonic Capacity C(η, N) &amp; Path-Graph Memory Scaling</h2>
          <div class="kpi-row">
            <div class="kpi"><div class="k-label">Link Transmittance η</div><div class="k-val" id="net-k-eta">0.5012</div></div>
            <div class="kpi"><div class="k-label">Capacity C(η, N)</div><div class="k-val" id="net-k-cap">0.6253 bits/mode</div></div>
            <div class="kpi"><div class="k-label">Piecemaker Memory</div><div class="k-val" id="net-k-pm">10 qubits</div></div>
            <div class="kpi"><div class="k-label">Quantum Switch Memory</div><div class="k-val">1 qubit</div></div>
          </div>
          <div class="svg-box" id="net-svg-box"></div>
        </div>
      </div>
    </section>

    <!-- TAB 6: QAI 1.6 PHYSICAL QPU SCALING & SNSPD PASSPORT v2 -->
    <section class="tab-panel" id="tab-6">
      <div class="grid">
        <div class="card">
          <h2>Papers 09 &amp; 10 · Physical QPU &amp; SNSPD Selector</h2>
          <label for="qpu-depth-mode">GHZ Circuit Family (48,600 Physical IQM Shots)</label>
          <select id="qpu-depth-mode" onchange="renderQpuV16Tab()">
            <option value="logdepth">Log-Depth Tree GHZ (8Q / 12Q / 16Q)</option>
            <option value="linear">Linear-Depth GHZ (3Q / 4Q / 6Q / 8Q)</option>
          </select>
          <p style="font-size:12.5px;color:var(--muted);margin-top:12px;">
            Live physical superconducting QPU runs show 2D Square-20 (<code>QPU-GARNET-20PQ</code>, <code>22,800</code> shots) certifying 16-qubit GME (<code>F = 0.6613 ± 0.0154</code>, CHSH <code>S = 2.670</code>, <code>14.23σ</code>), while Star-24 (<code>QPU-SIRIUS-24PQ</code>, <code>25,800</code> shots, CHSH <code>S = 2.526</code>, <code>10.73σ</code>) drops to <code>F = 0.1444</code> at <code>16Q</code>.
          </p>
          <p style="font-size:12.5px;color:var(--muted);margin-top:8px;">
            On <code>sim:belenos</code> threshold SNSPDs (<code>1,000</code> shots), naive two-click coincidence filtering hides <code>970</code> photon losses behind <code>V_HOM_apparent = 0.9583</code>; Passport v2 enforces disjoint <code>1 + 970 + 29 + 0 = 1,000</code> and <code>U_sig == U_cal</code>.
          </p>
          <a class="paper-link" href="https://aton-qai.ai/research/cross-topology-entanglement-scaling-iqm-sirius-vs-garnet" target="_blank" rel="noopener">↗ Read Paper 09 (48,600 IQM Shots)</a><br/>
          <a class="paper-link" href="https://aton-qai.ai/research/threshold-snspd-vs-pnr-detection-hom-visibility-and-passport-v2" target="_blank" rel="noopener">↗ Read Paper 10 (SNSPD &amp; Passport v2)</a><br/>
          <a class="paper-link" href="https://aton-qai.ai/docs/doc-14-verification-passport-v2-and-loss-denominator/" target="_blank" rel="noopener">↗ DOC-14: Verification Passport v2</a>
        </div>
        <div class="card">
          <h2>Star-24 vs Square-20 GHZ Scaling &amp; Disjoint SNSPD Loss Partition</h2>
          <div class="kpi-row">
            <div class="kpi"><div class="k-label">Garnet CHSH S</div><div class="k-val">2.670 (14.23σ)</div></div>
            <div class="kpi"><div class="k-label">Sirius CHSH S</div><div class="k-val">2.526 (10.73σ)</div></div>
            <div class="kpi"><div class="k-label">16Q GHZ Proxy</div><div class="k-val" id="v16-k-16q">0.6613 vs 0.1444</div></div>
            <div class="kpi"><div class="k-label">sim:belenos V_HOM</div><div class="k-val">0.9583 (97% loss)</div></div>
          </div>
          <div class="svg-box" id="v16-qpu-svg-box"></div>
        </div>
      </div>
    </section>

    <!-- TAB 7: QAI 1.6 BOSON SAMPLING, MODELLAB & OCI PROOFS -->
    <section class="tab-panel" id="tab-7">
      <div class="grid">
        <div class="card">
          <h2>Papers 12–17 · Saturation, LoRA &amp; OCI Verification</h2>
          <p style="font-size:12.5px;color:var(--muted);margin-top:4px;">
            Closed <strong>QAI v1.6.0</strong> benchmarks combining <code>EMU-SAMPLING-L4</code> GPU boson sampling (<code>500</code> shots/circuit), local RTX 4080 <code>PEFT LoRA</code> held-out evaluation (<code>QAI-Bench-1.6</code>: <code>0/6 -> 3/6</code>), hardened Linux OCI (<code>80/80</code> on <code>runc 1.5.1</code>), <code>9</code> Z3 UNSAT contracts, <code>10</code> TLA+ specs, <code>33 TB</code> encrypted vault (<code>1.0423 GiB</code> E2E), and <code>396</code> QPU availability probes (<code>0.0%</code> Paris photonic uptime).
          </p>
          <a class="paper-link" href="https://aton-qai.ai/research/qai-language-1-1-cophi-openqasm3-exact-rational-phase-and-24-mode-gram" target="_blank" rel="noopener">↗ Read Paper 11 (.qai 1.1 &amp; CO-Phi)</a><br/>
          <a class="paper-link" href="https://aton-qai.ai/research/finite-sample-entropy-and-tvd-breakdown-in-multi-photon-boson-sampling" target="_blank" rel="noopener">↗ Read Paper 12 (Boson Entropy Breakdown)</a><br/>
          <a class="paper-link" href="https://aton-qai.ai/research/why-small-sft-fails-on-formal-dsl-compilers-rtx4080-lora-c16-rag" target="_blank" rel="noopener">↗ Read Paper 13 (RTX 4080 LoRA vs RLVR)</a><br/>
          <a class="paper-link" href="https://aton-qai.ai/docs/doc-15-qai-1-6-release-and-1-7-to-2-0-roadmap/" target="_blank" rel="noopener">↗ DOC-15: v1.6.0 Release &amp; v1.7–v2.0+ Roadmap</a>
        </div>
        <div class="card">
          <h2>v1.6.0 Multi-Subsystem Empirical Matrix</h2>
          <div class="kpi-row">
            <div class="kpi"><div class="k-label">8P/16M Entropy</div><div class="k-val">8.9498 / 8.9658b</div></div>
            <div class="kpi"><div class="k-label">QAI-Bench-1.6</div><div class="k-val">0/6 → 3/6 (+50%)</div></div>
            <div class="kpi"><div class="k-label">Linux OCI Run</div><div class="k-val">80 / 80 (runc 1.5.1)</div></div>
            <div class="kpi"><div class="k-label">Formal Contracts</div><div class="k-val">8L4 · 9Z3 · 10TLA+</div></div>
          </div>
          <div class="svg-box" id="v16-sys-svg-box"></div>
        </div>
      </div>
    </section>
  </div>

  <script>
    const MZI_DATA = {
      nominal: { label: "Nominal Drift", ewma: 74.16, mlp: 73.64, stat: 73.21, rmseE: 0.0612, rmseM: 0.1747, delta: -0.519 },
      fast_drift: { label: "Fast Drift", ewma: 73.76, mlp: 73.39, stat: 58.19, rmseE: 0.1535, rmseM: 0.2125, delta: -0.369 },
      phase_jump: { label: "Phase Jump", ewma: 73.23, mlp: 73.12, stat: 61.04, rmseE: 0.2404, rmseM: 0.2535, delta: -0.109 },
      high_loss: { label: "High Loss", ewma: 15.23, mlp: 15.07, stat: 14.21, rmseE: 0.1332, rmseM: 0.2518, delta: -0.160 },
      telemetry_dropout: { label: "Telemetry Drop", ewma: 74.15, mlp: 73.44, stat: 73.18, rmseE: 0.0647, rmseM: 0.2050, delta: -0.713 },
      delayed_actuation: { label: "Delayed Act.", ewma: 74.11, mlp: 72.69, stat: 73.05, rmseE: 0.0783, rmseM: 0.2830, delta: -1.423 }
    };

    function switchTab(idx) {
      document.querySelectorAll(".tab-btn").forEach((b, i) => b.classList.toggle("active", i === idx));
      document.querySelectorAll(".tab-panel").forEach((p, i) => p.classList.toggle("active", i === idx));
    }

    function renderMziTab() {
      const key = document.getElementById("mzi-regime").value;
      const alpha = parseFloat(document.getElementById("ewma-alpha").value);
      document.getElementById("ewma-alpha-val").textContent = alpha.toFixed(2);
      const d = MZI_DATA[key];
      const alphaPenalty = Math.abs(alpha - 0.25) * 1.8;
      const adjEwma = Math.max(0, d.ewma - alphaPenalty);
      const adjRmse = d.rmseE + Math.abs(alpha - 0.25) * 0.09;

      document.getElementById("mzi-k-ewma").textContent = adjEwma.toFixed(2) + "%";
      document.getElementById("mzi-k-mlp").textContent = d.mlp.toFixed(2) + "%";
      document.getElementById("mzi-k-rmse").textContent = adjRmse.toFixed(3) + " vs " + d.rmseM.toFixed(3) + "r";

      let rowsSvg = "";
      const keys = Object.keys(MZI_DATA);
      keys.forEach((k, idx) => {
        const r = MZI_DATA[k];
        const y = 55 + idx * 46;
        const wE = (r.ewma / 80) * 420;
        const wM = (r.mlp / 80) * 420;
        const wS = (r.stat / 80) * 420;
        const highlight = k === key ? `<rect x="10" y="${y - 6}" width="760" height="40" fill="rgba(234,179,8,0.08)" stroke="#eab308" stroke-width="0.8" rx="4"/>` : "";
        rowsSvg += `
          ${highlight}
          <text x="145" y="${y + 15}" text-anchor="end" fill="#e2e8f0" font-size="12" font-family="sans-serif">${r.label}</text>
          <rect x="155" y="${y}" width="${wE.toFixed(1)}" height="9" fill="#38bdf8" rx="2"/>
          <rect x="155" y="${y + 11}" width="${wM.toFixed(1)}" height="9" fill="#eab308" rx="2"/>
          <rect x="155" y="${y + 22}" width="${wS.toFixed(1)}" height="6" fill="#64748b" rx="2"/>
          <text x="${(162 + Math.max(wE, wM)).toFixed(1)}" y="${y + 16}" fill="#f8fafc" font-size="11" font-family="monospace">EWMA ${r.ewma.toFixed(2)}% vs MLP ${r.mlp.toFixed(2)}% (${r.delta.toFixed(2)} pp) · RMSE ${r.rmseE.toFixed(3)}r</text>
        `;
      });

      document.getElementById("mzi-svg-box").innerHTML = `
        <svg viewBox="0 0 780 345" width="100%" height="auto">
          <text x="16" y="24" fill="#fde047" font-family="monospace" font-size="11.5">TARGET PORT DETECTION PROBABILITY (%) ACROSS 6 DRIFT &amp; LOSS REGIMES (8,192 PROBES/EPISODE)</text>
          <rect x="155" y="34" width="10" height="10" fill="#38bdf8"/><text x="170" y="43" fill="#cbd5e1" font-size="11">EWMA Filter (α=${alpha.toFixed(2)})</text>
          <rect x="310" y="34" width="10" height="10" fill="#eab308"/><text x="325" y="43" fill="#cbd5e1" font-size="11">3-Seed MLP Neural Controller</text>
          <rect x="515" y="34" width="10" height="10" fill="#64748b"/><text x="530" y="43" fill="#cbd5e1" font-size="11">Static Baseline (128 probes)</text>
          ${rowsSvg}
        </svg>
      `;
    }

    function renderFvTab() {
      const tier = document.getElementById("fv-tier").value;
      document.getElementById("fv-svg-box").innerHTML = `
        <svg viewBox="0 0 780 210" width="100%" height="auto">
          <rect x="14" y="16" width="175" height="175" fill="#131e36" stroke="${tier==='lean'||tier==='all'?'#eab308':'#263554'}" stroke-width="1.5" rx="6"/>
          <text x="26" y="40" fill="#fde047" font-family="monospace" font-size="11">TIER 1 · LEAN 4.34.1</text>
          <text x="26" y="78" fill="#ffffff" font-size="30" font-weight="bold">8 / 8</text>
          <text x="26" y="100" fill="#34d399" font-family="monospace" font-size="11">0 sorry axioms</text>
          <text x="26" y="125" fill="#cbd5e1" font-size="11">• Photon conservation</text>
          <text x="26" y="143" fill="#cbd5e1" font-size="11">• Identity lowering</text>
          <text x="26" y="161" fill="#cbd5e1" font-size="11">• Receipt gate &amp; idemp.</text>

          <rect x="205" y="16" width="175" height="175" fill="#131e36" stroke="${tier==='smt'||tier==='all'?'#eab308':'#263554'}" stroke-width="1.5" rx="6"/>
          <text x="217" y="40" fill="#fde047" font-family="monospace" font-size="11">TIER 2 · Z3 SMT 5.1.0</text>
          <text x="217" y="78" fill="#ffffff" font-size="30" font-weight="bold">5 / 5</text>
          <text x="217" y="100" fill="#34d399" font-family="monospace" font-size="11">ALL UNSAT</text>
          <text x="217" y="125" fill="#cbd5e1" font-size="11">• Fock norm bounds</text>
          <text x="217" y="143" fill="#cbd5e1" font-size="11">• 256-bit TVD contract</text>
          <text x="217" y="161" fill="#cbd5e1" font-size="11">• Decimal &amp; epoch fence</text>

          <rect x="396" y="16" width="175" height="175" fill="#131e36" stroke="${tier==='tla'||tier==='all'?'#eab308':'#263554'}" stroke-width="1.5" rx="6"/>
          <text x="408" y="40" fill="#fde047" font-family="monospace" font-size="11">TIER 3 · TLC 2.19 TLA+</text>
          <text x="408" y="78" fill="#ffffff" font-size="30" font-weight="bold">9 / 9</text>
          <text x="408" y="100" fill="#34d399" font-family="monospace" font-size="11">0 MODEL ERRORS</text>
          <text x="408" y="125" fill="#cbd5e1" font-size="11">• Pre-RUNNING quarantine</text>
          <text x="408" y="143" fill="#cbd5e1" font-size="11">• Zombie worker fencing</text>
          <text x="408" y="161" fill="#cbd5e1" font-size="11">• Crash reconciliation</text>

          <rect x="587" y="16" width="179" height="175" fill="#131e36" stroke="${tier==='runtime'||tier==='all'?'#eab308':'#263554'}" stroke-width="1.5" rx="6"/>
          <text x="599" y="40" fill="#fde047" font-family="monospace" font-size="11">TIER 4 · RUNTIME &amp; CI</text>
          <text x="599" y="78" fill="#ffffff" font-size="30" font-weight="bold">48 + 128</text>
          <text x="599" y="100" fill="#38bdf8" font-family="monospace" font-size="11">HYPOTHESIS + mTLS 1.3</text>
          <text x="599" y="125" fill="#cbd5e1" font-size="11">• 48 property suites</text>
          <text x="599" y="143" fill="#cbd5e1" font-size="11">• 128/128 mTLS loopback</text>
          <text x="599" y="161" fill="#cbd5e1" font-size="11">• 31/146 live Linux cloud</text>
        </svg>
      `;
    }

    function comb(n, k) {
      if (k < 0 || k > n) return 0;
      k = Math.min(k, n - k);
      let res = 1;
      for (let i = 1; i <= k; i++) res = Math.round((res * (n - k + i)) / i);
      return res;
    }

    function renderDualityTab() {
      const frac = parseFloat(document.getElementById("duality-theta").value);
      const theta = frac * Math.PI;
      const m = parseInt(document.getElementById("fock-modes").value, 10);
      const n = parseInt(document.getElementById("fock-photons").value, 10);

      document.getElementById("duality-theta-val").textContent = `${frac.toFixed(3)} π (${(frac * 180).toFixed(1)}°)`;
      document.getElementById("fock-modes-val").textContent = m;
      document.getElementById("fock-photons-val").textContent = n;

      const zL = -Math.cos(theta);
      const zQ = Math.cos(theta);
      const dZL = Math.sin(theta);
      const dZQ = -Math.sin(theta);
      const dim = comb(m + n - 1, n);

      document.getElementById("dual-k-zl").textContent = (zL >= 0 ? "+" : "") + zL.toFixed(4);
      document.getElementById("dual-k-zq").textContent = (zQ >= 0 ? "+" : "") + zQ.toFixed(4);
      document.getElementById("dual-k-grad").textContent = `+${dZL.toFixed(3)} vs ${dZQ.toFixed(3)}`;
      const dimEl = document.getElementById("dual-k-dim");
      dimEl.textContent = dim.toLocaleString() + (dim <= 1000000 ? " (OK)" : " (REJECTED)");
      dimEl.style.color = dim <= 1000000 ? "#34d399" : "#fb7185";

      let ptsL = [], ptsQ = [];
      for (let k = 0; k <= 50; k++) {
        const t = (k / 50) * Math.PI;
        const x = 60 + (k / 50) * 680;
        const yL = 140 - (-Math.cos(t)) * 95;
        const yQ = 140 - (Math.cos(t)) * 95;
        ptsL.push(`${x.toFixed(1)},${yL.toFixed(1)}`);
        ptsQ.push(`${x.toFixed(1)},${yQ.toFixed(1)}`);
      }
      const curX = 60 + frac * 680;
      const curYL = 140 - zL * 95;
      const curYQ = 140 - zQ * 95;

      document.getElementById("duality-svg-box").innerHTML = `
        <svg viewBox="0 0 780 280" width="100%" height="auto">
          <line x1="60" y1="140" x2="740" y2="140" stroke="#334155" stroke-dasharray="4,4"/>
          <line x1="${curX.toFixed(1)}" y1="35" x2="${curX.toFixed(1)}" y2="245" stroke="#fde047" stroke-dasharray="3,3"/>
          <polyline fill="none" stroke="#38bdf8" stroke-width="3" points="${ptsL.join(" ")}"/>
          <polyline fill="none" stroke="#eab308" stroke-width="2.5" stroke-dasharray="6,4" points="${ptsQ.join(" ")}"/>
          <circle cx="${curX.toFixed(1)}" cy="${curYL.toFixed(1)}" r="6" fill="#38bdf8"/>
          <circle cx="${curX.toFixed(1)}" cy="${curYQ.toFixed(1)}" r="6" fill="#eab308"/>
          <text x="70" y="26" fill="#38bdf8" font-family="monospace" font-size="12">─── Photonic Dual-Rail &lt;Z_L(θ)&gt; = -cos(θ) [d&lt;Z_L&gt;/dθ = +sin(θ)]</text>
          <text x="465" y="26" fill="#eab308" font-family="monospace" font-size="12">- - OpenQASM 3.0 &lt;Z(θ)&gt; = +cos(θ) [d&lt;Z&gt;/dθ = -sin(θ)]</text>
          <text x="60" y="266" fill="#94a3b8" font-family="monospace" font-size="11">θ = 0</text>
          <text x="286" y="266" fill="#fde047" font-family="monospace" font-size="11">θ = π/3 (±0.8660254)</text>
          <text x="400" y="266" fill="#94a3b8" font-family="monospace" font-size="11">θ = π/2</text>
          <text x="720" y="266" fill="#94a3b8" font-family="monospace" font-size="11">θ = π</text>
        </svg>
      `;
    }

    function renderBargmannTab() {
      const r = parseFloat(document.getElementById("barg-r").value);
      const phiFrac = parseFloat(document.getElementById("barg-phi").value);
      const eta = parseFloat(document.getElementById("barg-eta").value);
      const phi = phiFrac * Math.PI;

      document.getElementById("barg-r-val").textContent = r.toFixed(2);
      document.getElementById("barg-phi-val").textContent = phiFrac.toFixed(2) + " π";
      document.getElementById("barg-eta-val").textContent = eta.toFixed(2);

      const v = r * r;
      const pHomPre = 0.5 * (1 - v);
      const p111 = (1 / 9) * (1 + 2 * Math.pow(r, 3) * Math.cos(phi));
      const det3 = 1 - 3 * r * r + 2 * Math.pow(r, 3) * Math.cos(phi);

      document.getElementById("barg-k-v").textContent = v.toFixed(4);
      document.getElementById("barg-k-hom").textContent = pHomPre.toFixed(4);
      document.getElementById("barg-k-p111").textContent = p111.toFixed(4);
      const detEl = document.getElementById("barg-k-det");
      detEl.textContent = (det3 >= 0 ? "+" : "") + det3.toFixed(4) + (det3 >= -1e-9 ? " (PSD)" : " (UNPHYSICAL)");
      detEl.style.color = det3 >= -1e-9 ? "#34d399" : "#fb7185";

      let ptsP = [];
      for (let k = 0; k <= 50; k++) {
        const p = (k / 50) * Math.PI;
        const val = (1 / 9) * (1 + 2 * Math.pow(r, 3) * Math.cos(p));
        const x = 60 + (k / 50) * 680;
        const y = 240 - (val / 0.35) * 190;
        ptsP.push(`${x.toFixed(1)},${y.toFixed(1)}`);
      }
      const curX = 60 + phiFrac * 680;
      const curY = 240 - (p111 / 0.35) * 190;

      document.getElementById("bargmann-svg-box").innerHTML = `
        <svg viewBox="0 0 780 275" width="100%" height="auto">
          <text x="60" y="26" fill="#fde047" font-family="monospace" font-size="12">3-PHOTON TRITTER COINCIDENCE P(1,1,1) VS. COLLECTIVE BARGMANN TRIAD PHASE φ = arg(S_12 S_23 S_31)</text>
          <line x1="60" y1="240" x2="740" y2="240" stroke="#334155"/>
          <polyline fill="none" stroke="#38bdf8" stroke-width="3" points="${ptsP.join(" ")}"/>
          <circle cx="${curX.toFixed(1)}" cy="${curY.toFixed(1)}" r="6.5" fill="#eab308"/>
          <text x="${Math.min(620, curX + 10).toFixed(1)}" y="${Math.max(50, curY - 10).toFixed(1)}" fill="#fde047" font-family="monospace" font-size="11.5">P(1,1,1) = ${p111.toFixed(4)} (η³P = ${(Math.pow(eta,3)*p111).toFixed(4)})</text>
          <text x="60" y="262" fill="#94a3b8" font-family="monospace" font-size="11">φ = 0 (Constructive)</text>
          <text x="380" y="262" fill="#94a3b8" font-family="monospace" font-size="11">φ = π/2</text>
          <text x="655" y="262" fill="#94a3b8" font-family="monospace" font-size="11">φ = π (Destructive)</text>
        </svg>
      `;
    }

    function renderTwinTab() {
      const n = parseInt(document.getElementById("loss-photons").value, 10);
      const lensPct = parseFloat(document.getElementById("loss-lens").value);
      const smfPct = parseFloat(document.getElementById("loss-smf").value);

      document.getElementById("loss-photons-val").textContent = n + (n === 1 ? " photon" : " photons");
      document.getElementById("loss-lens-val").textContent = lensPct.toFixed(1) + "%";
      document.getElementById("loss-smf-val").textContent = smfPct.toFixed(1) + "%";

      const lensYield = Math.pow(lensPct / 100, n) * 100;
      const smfYield = Math.pow(smfPct / 100, n) * 100;
      const inf = lensYield / Math.max(smfYield, 1e-12);

      document.getElementById("twin-k-lens").textContent = lensYield.toFixed(3) + "%";
      document.getElementById("twin-k-smf").textContent = smfYield.toFixed(4) + "%";
      document.getElementById("twin-k-inf").textContent = inf.toFixed(1) + "×";

      const w1 = 520;
      const w2 = (lensPct / 100) * 520;
      const w3 = (smfPct / 100) * 520;
      const w4 = Math.max(4, (smfYield / 100) * 520);

      document.getElementById("twin-svg-box").innerHTML = `
        <svg viewBox="0 0 780 265" width="100%" height="auto">
          <text x="20" y="26" fill="#fde047" font-family="monospace" font-size="12">MANDATORY 4-STAGE LOSS DENOMINATOR CASCADE (PAPERS 05 &amp; 08)</text>
          <text x="20" y="58" fill="#e2e8f0" font-family="monospace" font-size="11.5">1. Emitted Source Pulses (100.0%)</text>
          <rect x="20" y="65" width="${w1}" height="16" fill="#38bdf8" rx="3"/>
          <text x="20" y="108" fill="#e2e8f0" font-family="monospace" font-size="11.5">2. First Collection Lens (${lensPct.toFixed(1)}% single-photon · ${lensYield.toFixed(3)}% ${n}-photon)</text>
          <rect x="20" y="115" width="${w2.toFixed(1)}" height="16" fill="#eab308" rx="3"/>
          <text x="20" y="158" fill="#e2e8f0" font-family="monospace" font-size="11.5">3. Single-Mode Fiber Coupled (${smfPct.toFixed(1)}% single-photon)</text>
          <rect x="20" y="165" width="${w3.toFixed(1)}" height="16" fill="#34d399" rx="3"/>
          <text x="20" y="208" fill="#fde047" font-family="monospace" font-size="11.5">4. True End-to-End ${n}-Photon SMF Coincidence Yield (${smfYield.toFixed(4)}% · Overclaim inflation if omitted: ${inf.toFixed(1)}×)</text>
          <rect x="20" y="215" width="${w4.toFixed(1)}" height="16" fill="#fb7185" rx="3"/>
        </svg>
      `;
    }

    function gEntropy(x) {
      if (x <= 1e-12) return 0;
      return (x + 1) * Math.log2(x + 1) - x * Math.log2(x);
    }

    function renderNetTab() {
      const L = parseFloat(document.getElementById("net-len").value);
      const att = parseFloat(document.getElementById("net-att").value);
      const N = parseFloat(document.getElementById("net-n").value);
      const nodes = parseInt(document.getElementById("net-nodes").value, 10);

      document.getElementById("net-len-val").textContent = L.toFixed(1) + " km";
      document.getElementById("net-att-val").textContent = att.toFixed(2) + " dB/km";
      document.getElementById("net-n-val").textContent = N.toFixed(2);
      document.getElementById("net-nodes-val").textContent = nodes + " nodes";

      const eta = Math.pow(10, -(L * att) / 10);
      const cap = Math.max(0, gEntropy(N) - gEntropy((1 - eta) * N));
      const pmQubits = Math.floor(nodes / 2);

      document.getElementById("net-k-eta").textContent = eta.toFixed(4);
      document.getElementById("net-k-cap").textContent = cap.toFixed(4) + " bits/mode";
      document.getElementById("net-k-pm").textContent = pmQubits + " qubits";

      let ptsCap = [];
      for (let k = 1; k <= 50; k++) {
        const e = k / 50;
        const c = Math.max(0, gEntropy(N) - gEntropy((1 - e) * N));
        const x = 60 + e * 680;
        const y = 235 - Math.min(c / 4.5, 1) * 185;
        ptsCap.push(`${x.toFixed(1)},${y.toFixed(1)}`);
      }
      const curX = 60 + eta * 680;
      const curY = 235 - Math.min(cap / 4.5, 1) * 185;

      document.getElementById("net-svg-box").innerHTML = `
        <svg viewBox="0 0 780 270" width="100%" height="auto">
          <text x="60" y="26" fill="#fde047" font-family="monospace" font-size="12">EXACT PURE-LOSS BOSONIC CAPACITY C(η, N) = g(N) - g((1-η)N) FOR MEAN PHOTONS N = ${N.toFixed(2)}</text>
          <line x1="60" y1="235" x2="740" y2="235" stroke="#334155"/>
          <polyline fill="none" stroke="#34d399" stroke-width="3" points="60,235 ${ptsCap.join(" ")}"/>
          <circle cx="${curX.toFixed(1)}" cy="${curY.toFixed(1)}" r="6.5" fill="#eab308"/>
          <text x="${Math.min(540, curX + 10).toFixed(1)}" y="${Math.max(50, curY - 10).toFixed(1)}" fill="#fde047" font-family="monospace" font-size="11.5">L=${L}km → η=${eta.toFixed(3)}, C=${cap.toFixed(3)} bits/mode</text>
          <text x="60" y="258" fill="#94a3b8" font-family="monospace" font-size="11">η = 0.0 (Total Loss)</text>
          <text x="380" y="258" fill="#94a3b8" font-family="monospace" font-size="11">η = 0.5</text>
          <text x="665" y="258" fill="#94a3b8" font-family="monospace" font-size="11">η = 1.0 (Lossless)</text>
        </svg>
      `;
    }


    function renderQpuV16Tab() {
      const mode = document.getElementById("qpu-depth-mode").value;
      const rows = mode === "logdepth"
        ? [
            { label: "8Q (depth 3)", garnet: 0.7994, sirius: 0.5987 },
            { label: "12Q (depth 4)", garnet: 0.6982, sirius: 0.3031 },
            { label: "16Q (depth 4)", garnet: 0.6613, sirius: 0.1444 }
          ]
        : [
            { label: "3Q Linear", garnet: 0.9490, sirius: 0.8750 },
            { label: "4Q Linear", garnet: 0.9205, sirius: 0.8325 },
            { label: "6Q Linear", garnet: 0.8645, sirius: 0.7520 },
            { label: "8Q Linear", garnet: 0.7650, sirius: 0.6565 }
          ];
      let bars = "";
      rows.forEach((r, idx) => {
        const y = 52 + idx * 48;
        const wG = r.garnet * 460;
        const wS = r.sirius * 460;
        bars += `
          <text x="125" y="${y + 15}" text-anchor="end" fill="#e2e8f0" font-size="12" font-family="monospace">${r.label}</text>
          <rect x="135" y="${y}" width="${wG.toFixed(1)}" height="12" fill="#34d399" rx="2"/>
          <rect x="135" y="${y + 15}" width="${wS.toFixed(1)}" height="12" fill="#38bdf8" rx="2"/>
          <text x="${(142 + Math.max(wG, wS)).toFixed(1)}" y="${y + 16}" fill="#fde047" font-size="11.5" font-family="monospace">Garnet ${r.garnet.toFixed(4)} | Sirius ${r.sirius.toFixed(4)}</text>
        `;
      });
      document.getElementById("v16-qpu-svg-box").innerHTML = `
        <svg viewBox="0 0 780 265" width="100%" height="auto">
          <text x="20" y="24" fill="#fde047" font-family="monospace" font-size="11.5">PHYSICAL QPU GHZ Z+X FIDELITY PROXY: SQUARE-20 GARNET vs STAR-24 SIRIUS</text>
          <line x1="365" y1="40" x2="365" y2="242" stroke="#fb7185" stroke-dasharray="4,4"/>
          <text x="370" y="48" fill="#fb7185" font-family="monospace" font-size="10.5">0.50 GME threshold</text>
          ${bars}
        </svg>
      `;
    }

    function renderSysV16Tab() {
      document.getElementById("v16-sys-svg-box").innerHTML = `
        <svg viewBox="0 0 780 240" width="100%" height="auto">
          <text x="20" y="24" fill="#fde047" font-family="monospace" font-size="11.5">QAI v1.6.0 BOSON SAMPLING ENTROPY SATURATION &amp; MODELLAB BREAKDOWN</text>
          <text x="20" y="56" fill="#cbd5e1" font-family="monospace" font-size="11.5">EMU-SAMPLING-L4 4P/8M  (170/500 unique): H = 6.9962 bits</text>
          <rect x="20" y="64" width="390" height="14" fill="#38bdf8" rx="2"/>
          <text x="20" y="102" fill="#cbd5e1" font-family="monospace" font-size="11.5">EMU-SAMPLING-L4 6P/12M (454/500 unique): H = 8.7773 bits</text>
          <rect x="20" y="110" width="489" height="14" fill="#eab308" rx="2"/>
          <text x="20" y="148" fill="#cbd5e1" font-family="monospace" font-size="11.5">EMU-SAMPLING-L4 8P/16M (496/500 unique): H = 8.9498 bits (ceil 8.9658)</text>
          <rect x="20" y="156" width="499" height="14" fill="#34d399" rx="2"/>
          <text x="20" y="202" fill="#94a3b8" font-family="monospace" font-size="11.5">RTX 4080 QAI-Bench-1.6: Base 0/6 → LoRA 3/6 (Physics 2/2, ABSTAIN 1/1, Compiler Syntax 0/3 → RLVR in 1.7)</text>
          <text x="20" y="222" fill="#94a3b8" font-family="monospace" font-size="11.5">Vault: 3 TB NVMe + 30 TB rclone crypt (1.0423 GiB E2E in 573.9s, 0 leaks) | OCI: 80/80 runc 1.5.1</text>
        </svg>
      `;
    }

    renderQpuV16Tab();
    renderSysV16Tab();
    renderMziTab();
    renderFvTab();
    renderDualityTab();
    renderBargmannTab();
    renderTwinTab();
    renderNetTab();
  </script>
</body>
</html>