-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfiblib_v5-4.html
More file actions
3619 lines (3229 loc) · 181 KB
/
Copy pathfiblib_v5-4.html
File metadata and controls
3619 lines (3229 loc) · 181 KB
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
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>fiblib — Topological Quantum Gate Compiler</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=Syne:wght@400;600;800&display=swap');
:root {
--bg: #06060f;
--surface: #0d0d1e;
--surface2: #12122a;
--surface3: #181835;
--border: #1e1e3f;
--accent: #5b5bd6;
--accent2: #7c3aed;
--gold: #f4a017;
--green: #22d3a5;
--red: #f43f5e;
--cyan: #06b6d4;
--orange: #fb923c;
--text: #e2e2f5;
--muted: #6868a8;
--mono: 'Space Mono', monospace;
--sans: 'Syne', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
background: var(--bg);
color: var(--text);
font-family: var(--sans);
min-height: 100vh;
overflow-x: hidden;
}
body::before {
content: '';
position: fixed;
inset: 0;
background-image:
linear-gradient(rgba(91,91,214,0.04) 1px, transparent 1px),
linear-gradient(90deg, rgba(91,91,214,0.04) 1px, transparent 1px);
background-size: 40px 40px;
pointer-events: none;
z-index: 0;
}
header {
position: relative;
z-index: 10;
padding: 2rem 3rem 1.8rem;
border-bottom: 1px solid var(--border);
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 2rem;
background: linear-gradient(180deg, rgba(91,91,214,0.08) 0%, transparent 100%);
}
.logo-block h1 {
font-family: var(--sans);
font-weight: 800;
font-size: 2.2rem;
letter-spacing: -0.03em;
background: linear-gradient(135deg, #a5b4fc 0%, #7c3aed 50%, #5b5bd6 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.logo-block .tagline {
font-family: var(--mono);
font-size: 0.68rem;
color: var(--muted);
letter-spacing: 0.12em;
text-transform: uppercase;
margin-top: 0.3rem;
}
.v2-badge {
font-family: var(--mono);
font-size: 0.6rem;
padding: 0.2rem 0.6rem;
border-radius: 2px;
background: rgba(34,211,165,0.1);
border: 1px solid rgba(34,211,165,0.35);
color: var(--green);
letter-spacing: 0.1em;
margin-left: 0.7rem;
vertical-align: middle;
}
.header-badges { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.badge {
font-family: var(--mono);
font-size: 0.65rem;
padding: 0.28rem 0.7rem;
border-radius: 2px;
letter-spacing: 0.07em;
text-transform: uppercase;
border: 1px solid;
}
.badge-green { border-color: var(--green); color: var(--green); background: rgba(34,211,165,0.06); }
.badge-gold { border-color: var(--gold); color: var(--gold); background: rgba(244,160,23,0.06); }
.badge-accent{ border-color: var(--accent); color: var(--accent); background: rgba(91,91,214,0.1); }
.badge-cyan { border-color: var(--cyan); color: var(--cyan); background: rgba(6,182,212,0.08); }
.badge-orange{ border-color: var(--orange);color: var(--orange);background: rgba(251,146,60,0.08); }
.badge-red { border-color: var(--red); color: var(--red); background: rgba(244,63,94,0.08); }
.tab-bar {
position: relative;
z-index: 10;
display: flex;
border-bottom: 1px solid var(--border);
padding: 0 3rem;
overflow-x: auto;
}
.tab {
font-family: var(--mono);
font-size: 0.72rem;
padding: 0.9rem 1.3rem;
letter-spacing: 0.08em;
text-transform: uppercase;
cursor: pointer;
color: var(--muted);
border-bottom: 2px solid transparent;
transition: all 0.2s;
white-space: nowrap;
background: none;
border-left: none; border-right: none; border-top: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab.compiler-tab { color: var(--gold); }
.tab.compiler-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
main {
position: relative;
z-index: 5;
padding: 2.5rem 3rem;
max-width: 1500px;
margin: 0 auto;
}
.panel { display: none; }
.panel.active { display: block; }
.section-label {
font-family: var(--mono);
font-size: 0.63rem;
letter-spacing: 0.2em;
text-transform: uppercase;
color: var(--muted);
margin-bottom: 0.5rem;
}
h2 { font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; margin-bottom: 0.35rem; }
.subtitle {
color: var(--muted);
font-family: var(--mono);
font-size: 0.75rem;
margin-bottom: 2rem;
line-height: 1.7;
}
/* changelog removed */
/* ── COMPILER LAYOUT ── */
.compiler-layout {
display: grid;
grid-template-columns: 340px 1fr;
gap: 2rem;
align-items: start;
}
.compiler-sidebar {
display: flex;
flex-direction: column;
gap: 1.2rem;
}
.control-box {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 4px;
padding: 1.4rem;
}
.control-box h3 {
font-size: 0.82rem;
font-weight: 700;
letter-spacing: -0.01em;
margin-bottom: 1rem;
color: var(--text);
display: flex;
align-items: center;
gap: 0.5rem;
}
.control-box h3 .icon {
width: 18px; height: 18px;
border-radius: 3px;
background: rgba(91,91,214,0.2);
border: 1px solid rgba(91,91,214,0.4);
display: flex; align-items: center; justify-content: center;
font-size: 0.6rem;
color: var(--accent);
flex-shrink: 0;
}
.field-group { margin-bottom: 1rem; }
.field-group:last-child { margin-bottom: 0; }
.field-group label {
display: block;
font-family: var(--mono);
font-size: 0.62rem;
color: var(--muted);
letter-spacing: 0.12em;
text-transform: uppercase;
margin-bottom: 0.35rem;
}
select, input[type="text"], input[type="number"] {
width: 100%;
background: var(--surface2);
border: 1px solid var(--border);
color: var(--text);
font-family: var(--mono);
font-size: 0.78rem;
padding: 0.55rem 0.8rem;
border-radius: 3px;
outline: none;
transition: border-color 0.2s;
}
select:focus, input[type="text"]:focus, input[type="number"]:focus {
border-color: var(--accent);
}
.eps-row { display: flex; align-items: center; gap: 0.8rem; }
.eps-display {
font-family: var(--mono);
font-size: 0.78rem;
color: var(--gold);
white-space: nowrap;
min-width: 70px;
}
input[type="range"] {
flex: 1;
background: none;
border: none;
padding: 0;
cursor: pointer;
accent-color: var(--gold);
}
.btn-compile {
display: block;
width: 100%;
padding: 0.8rem;
background: linear-gradient(135deg, var(--accent), var(--accent2));
color: white;
font-family: var(--mono);
font-size: 0.78rem;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
border: none;
border-radius: 3px;
cursor: pointer;
transition: all 0.2s;
position: relative;
overflow: hidden;
}
.btn-compile:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(91,91,214,0.4); }
.btn-compile:active { transform: translateY(0); }
.preset-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.preset-btn {
font-family: var(--mono);
font-size: 0.6rem;
padding: 0.25rem 0.55rem;
background: var(--surface2);
border: 1px solid var(--border);
color: var(--muted);
border-radius: 2px;
cursor: pointer;
transition: all 0.15s;
white-space: nowrap;
}
.preset-btn:hover { border-color: var(--gold); color: var(--gold); }
/* ── COMPILER OUTPUT ── */
.compiler-output {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.compile-status {
display: flex;
align-items: center;
gap: 1rem;
padding: 0.9rem 1.2rem;
border-radius: 3px;
border: 1px solid;
}
.compile-status.ok { background: rgba(34,211,165,0.07); border-color: rgba(34,211,165,0.25); }
.compile-status.err { background: rgba(244,63,94,0.07); border-color: rgba(244,63,94,0.25); }
.compile-status.warn { background: rgba(244,160,23,0.07); border-color: rgba(244,160,23,0.25); }
.compile-status.idle { background: rgba(104,104,168,0.07); border-color: var(--border); }
.compile-status .status-dot {
width: 8px; height: 8px;
border-radius: 50%;
flex-shrink: 0;
}
.ok .status-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.err .status-dot { background: var(--red); box-shadow: 0 0 8px var(--red); }
.warn .status-dot { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.idle .status-dot { background: var(--muted); }
.compile-status .status-text {
font-family: var(--mono);
font-size: 0.8rem;
font-weight: 700;
letter-spacing: 0.05em;
}
.ok .status-text { color: var(--green); }
.err .status-text { color: var(--red); }
.warn .status-text{ color: var(--gold); }
.idle .status-text{ color: var(--muted); }
.status-sub {
font-family: var(--mono);
font-size: 0.65rem;
color: var(--muted);
margin-top: 0.15rem;
}
.compile-section {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 4px;
overflow: hidden;
}
.compile-section-header {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.9rem 1.2rem;
background: var(--surface2);
border-bottom: 1px solid var(--border);
cursor: pointer;
user-select: none;
}
.compile-section-header:hover { background: var(--surface3); }
.cs-icon {
width: 22px; height: 22px;
border-radius: 3px;
display: flex; align-items: center; justify-content: center;
font-size: 0.65rem;
font-weight: 700;
flex-shrink: 0;
}
.cs-icon.step1 { background: rgba(91,91,214,0.15); color: var(--accent); border: 1px solid rgba(91,91,214,0.3); }
.cs-icon.step2 { background: rgba(6,182,212,0.1); color: var(--cyan); border: 1px solid rgba(6,182,212,0.3); }
.cs-icon.step3 { background: rgba(244,160,23,0.1); color: var(--gold); border: 1px solid rgba(244,160,23,0.3); }
.cs-icon.step4 { background: rgba(251,146,60,0.1); color: var(--orange); border: 1px solid rgba(251,146,60,0.3); }
.cs-icon.step5 { background: rgba(34,211,165,0.1); color: var(--green); border: 1px solid rgba(34,211,165,0.3); }
.cs-icon.stepE { background: rgba(244,63,94,0.1); color: var(--red); border: 1px solid rgba(244,63,94,0.3); }
.cs-icon.stepSK{ background: rgba(244,160,23,0.15); color: var(--gold); border: 1px solid rgba(244,160,23,0.4); }
.cs-title {
font-family: var(--mono);
font-size: 0.75rem;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
color: var(--text);
}
.cs-badge {
margin-left: auto;
font-family: var(--mono);
font-size: 0.62rem;
padding: 0.15rem 0.5rem;
border-radius: 2px;
background: rgba(34,211,165,0.1);
color: var(--green);
border: 1px solid rgba(34,211,165,0.2);
}
.cs-badge.warn { background: rgba(244,160,23,0.1); color: var(--gold); border-color: rgba(244,160,23,0.2); }
.cs-badge.err { background: rgba(244,63,94,0.1); color: var(--red); border-color: rgba(244,63,94,0.2); }
.cs-chevron {
font-size: 0.6rem;
color: var(--muted);
transition: transform 0.2s;
margin-left: 0.5rem;
}
.cs-chevron.open { transform: rotate(180deg); }
.compile-section-body {
padding: 1.2rem;
display: none;
}
.compile-section-body.open { display: block; }
/* FUSION TREE VIZ */
.tree-canvas-wrap {
background: var(--surface2);
border: 1px solid var(--border);
border-radius: 3px;
overflow-x: auto;
margin-bottom: 1rem;
}
canvas.tree-canvas {
display: block;
min-width: 100%;
}
/* MATRIX DISPLAY */
.matrix-wrap {
display: flex;
gap: 1.5rem;
flex-wrap: wrap;
align-items: flex-start;
}
.matrix-block {
background: var(--surface2);
border: 1px solid var(--border);
border-radius: 3px;
padding: 0.8rem 1rem;
font-family: var(--mono);
font-size: 0.72rem;
}
.matrix-block .mx-label {
color: var(--muted);
font-size: 0.6rem;
letter-spacing: 0.12em;
text-transform: uppercase;
margin-bottom: 0.5rem;
}
.matrix-block .mx-eq {
color: var(--gold);
margin-bottom: 0.5rem;
font-size: 0.7rem;
}
.mx-grid {
display: grid;
gap: 2px;
}
.mx-cell {
background: var(--surface3);
border: 1px solid var(--border);
border-radius: 2px;
padding: 0.3rem 0.5rem;
text-align: center;
color: var(--text);
min-width: 72px;
font-size: 0.68rem;
}
.mx-cell.real { color: #a5b4fc; }
.mx-cell.imag { color: var(--cyan); }
.mx-cell.zero { color: var(--muted); opacity: 0.5; }
.mx-cell.phase-highlight { color: var(--gold); }
/* GATE SEQUENCE */
.gate-seq {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.3rem;
margin-top: 0.6rem;
}
.gate-box {
background: var(--surface3);
border: 1px solid var(--border);
border-radius: 3px;
padding: 0.35rem 0.65rem;
font-family: var(--mono);
font-size: 0.65rem;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.1rem;
}
.gate-label { color: var(--accent); font-weight: 700; }
.gate-phase { color: var(--gold); font-size: 0.58rem; }
.gate-arrow { color: var(--muted); font-size: 0.8rem; }
/* BASIS CARDS */
.basis-cards { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.basis-card {
background: var(--surface3);
border: 1px solid var(--border);
border-radius: 3px;
padding: 0.7rem 0.9rem;
font-family: var(--mono);
font-size: 0.7rem;
}
.basis-card .bk-anyon { color: var(--accent); font-weight: 700; margin-bottom: 0.3rem; }
.basis-card .bk-cb { color: var(--green); }
.basis-card .bk-amp { color: var(--muted); font-size: 0.62rem; margin-top: 0.2rem; }
/* ERROR CHECKS */
.error-checks { display: flex; flex-direction: column; gap: 0.5rem; }
.check-row {
display: flex;
align-items: flex-start;
gap: 0.75rem;
padding: 0.65rem 0.8rem;
background: var(--surface2);
border: 1px solid var(--border);
border-radius: 3px;
font-family: var(--mono);
font-size: 0.7rem;
}
.check-row.pass-row { border-left: 3px solid var(--green); }
.check-row.fail-row { border-left: 3px solid var(--red); }
.check-row.warn-row { border-left: 3px solid var(--gold); }
.check-row .chk-icon { font-size: 0.85rem; flex-shrink: 0; margin-top: 0.1rem; }
.check-row .chk-body { flex: 1; }
.check-row .chk-name { color: var(--text); font-weight: 700; }
.check-row .chk-val { color: var(--muted); font-size: 0.65rem; margin-top: 0.15rem; }
.check-row .chk-explain { color: var(--muted); font-size: 0.62rem; margin-top: 0.3rem; line-height: 1.6; }
.check-row .chk-pass { color: var(--green); font-size: 0.65rem; font-weight: 700; }
.check-row .chk-fail { color: var(--red); font-size: 0.65rem; font-weight: 700; }
.check-row .chk-warn { color: var(--gold); font-size: 0.65rem; font-weight: 700; }
/* APPROXIMATION */
.approx-block {
background: var(--surface2);
border: 1px solid rgba(244,160,23,0.25);
border-radius: 3px;
padding: 1rem;
margin-bottom: 1rem;
}
.approx-block .apx-title {
font-family: var(--mono);
font-size: 0.65rem;
color: var(--gold);
letter-spacing: 0.12em;
text-transform: uppercase;
margin-bottom: 0.6rem;
}
.approx-metrics {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 0.5rem;
margin-bottom: 0.8rem;
}
.apx-metric {
background: var(--surface3);
border: 1px solid var(--border);
border-radius: 2px;
padding: 0.5rem 0.7rem;
font-family: var(--mono);
font-size: 0.68rem;
}
.apx-metric .am-label { color: var(--muted); font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase; }
.apx-metric .am-val { color: var(--text); font-weight: 700; margin-top: 0.15rem; }
/* SK STEPS TABLE */
.sk-steps {
width: 100%;
border-collapse: collapse;
font-family: var(--mono);
font-size: 0.7rem;
}
.sk-steps th {
background: var(--surface3);
padding: 0.5rem 0.8rem;
text-align: left;
color: var(--muted);
font-size: 0.6rem;
letter-spacing: 0.1em;
text-transform: uppercase;
border-bottom: 1px solid var(--border);
}
.sk-steps td { padding: 0.5rem 0.8rem; border-bottom: 1px solid rgba(30,30,63,0.4); }
.sk-steps tr:hover td { background: rgba(91,91,214,0.03); }
/* UNITARY DISPLAY */
.unitary-section {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1rem;
}
.u-panel {
background: var(--surface2);
border: 1px solid var(--border);
border-radius: 3px;
padding: 0.9rem;
}
.u-panel .up-label {
font-family: var(--mono);
font-size: 0.6rem;
color: var(--muted);
letter-spacing: 0.12em;
text-transform: uppercase;
margin-bottom: 0.6rem;
}
.u-panel .up-val {
font-family: var(--mono);
font-size: 0.78rem;
color: var(--text);
line-height: 1.8;
}
.u-panel .up-highlight { color: var(--gold); }
.u-panel .up-good { color: var(--green); }
/* EMPTY STATE */
.empty-state {
text-align: center;
padding: 4rem 2rem;
color: var(--muted);
font-family: var(--mono);
font-size: 0.78rem;
}
.empty-state .big { font-size: 2rem; margin-bottom: 0.8rem; }
/* OVERVIEW / LEGACY PANELS */
.overview-grid {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 1px;
background: var(--border);
border: 1px solid var(--border);
margin-bottom: 2rem;
border-radius: 4px;
overflow: hidden;
}
.level-card {
background: var(--surface);
padding: 1.1rem;
cursor: pointer;
transition: background 0.15s;
position: relative;
}
.level-card:hover { background: var(--surface2); }
.level-card.selected { background: rgba(91,91,214,0.12); }
.level-card.selected::after {
content: '';
position: absolute;
top: 0; left: 0; right: 0;
height: 2px;
background: var(--accent);
}
.level-card .k-label {
font-family: var(--mono); font-size: 0.63rem; color: var(--muted);
letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 0.25rem;
}
.level-card .k-val {
font-weight: 800; font-size: 1.7rem; letter-spacing: -0.04em; line-height: 1; margin-bottom: 0.4rem;
}
.level-card .k-stats {
font-family: var(--mono); font-size: 0.62rem; color: var(--muted); line-height: 1.8;
}
.univ-tag {
display: inline-block; font-family: var(--mono); font-size: 0.58rem;
padding: 0.12rem 0.45rem; border-radius: 2px; letter-spacing: 0.1em; margin-top: 0.3rem;
}
.univ-tag.yes { background: rgba(34,211,165,0.1); color: var(--green); border: 1px solid rgba(34,211,165,0.25); }
.univ-tag.no { background: rgba(104,104,168,0.08); color: var(--muted); border: 1px solid var(--border); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.2rem; margin-bottom: 1.5rem; }
.stat-card {
background: var(--surface); border: 1px solid var(--border);
border-radius: 4px; padding: 1.1rem 1.3rem;
}
.stat-card .s-label {
font-family: var(--mono); font-size: 0.62rem; color: var(--muted);
letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.4rem;
}
.stat-card .s-val { font-weight: 800; font-size: 1.3rem; font-family: var(--mono); }
.stat-card .s-sub { font-family: var(--mono); font-size: 0.65rem; color: var(--muted); margin-top: 0.15rem; }
/* TABLE */
.table-wrapper {
background: var(--surface); border: 1px solid var(--border);
border-radius: 4px; overflow: auto; max-height: 380px;
}
table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.7rem; }
thead th {
background: var(--surface2); padding: 0.65rem 0.9rem; text-align: left;
color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase;
font-size: 0.6rem; border-bottom: 1px solid var(--border);
position: sticky; top: 0;
}
tbody tr { border-bottom: 1px solid rgba(30,30,63,0.5); }
tbody tr:hover { background: rgba(91,91,214,0.04); }
tbody td { padding: 0.55rem 0.9rem; }
.td-phase { color: var(--gold); }
.td-green { color: var(--green); }
.td-red { color: var(--red); }
/* DIM BAR */
.dim-bar {
display: flex; align-items: flex-end; gap: 4px; height: 70px;
padding: 0.7rem; background: var(--surface2); border: 1px solid var(--border);
border-radius: 3px; margin-top: 0.8rem;
}
.dim-segment {
flex: 1; background: var(--accent); opacity: 0.7;
border-radius: 2px 2px 0 0; min-width: 18px;
}
.dim-segment.is-int { background: var(--gold); }
.dim-label {
font-family: var(--mono); font-size: 0.58rem; color: var(--muted);
display: flex; justify-content: space-between; padding: 0 0.7rem 0.2rem;
}
/* THEOREMS */
.proof-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3rem; }
.theorem-card {
background: var(--surface); border: 1px solid var(--border);
border-radius: 4px; padding: 1.3rem; position: relative; overflow: hidden;
}
.theorem-card::before {
content: ''; position: absolute; top: 0; left: 0; right: 0;
height: 1px; background: linear-gradient(90deg, var(--accent), transparent);
}
.thm-id { font-family: var(--mono); font-size: 0.6rem; color: var(--accent); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 0.35rem; }
.thm-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.5rem; letter-spacing: -0.01em; }
.thm-eq { font-family: var(--mono); font-size: 0.74rem; color: var(--gold); padding: 0.45rem 0.7rem; background: rgba(244,160,23,0.06); border: 1px solid rgba(244,160,23,0.15); border-radius: 3px; margin-bottom: 0.7rem; word-break: break-all; }
.thm-proof { font-family: var(--mono); font-size: 0.67rem; color: var(--muted); line-height: 1.7; }
.thm-badges { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.7rem; }
.thm-badge { font-family: var(--mono); font-size: 0.58rem; padding: 0.13rem 0.45rem; border-radius: 2px; letter-spacing: 0.08em; }
.thm-badge.analytic { background: rgba(34,211,165,0.1); color: var(--green); border: 1px solid rgba(34,211,165,0.2); }
.thm-badge.computational { background: rgba(91,91,214,0.1); color: var(--accent); border: 1px solid rgba(91,91,214,0.2); }
/* VERIFY */
.verify-matrix { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; overflow: auto; margin-top: 1.5rem; }
.verify-matrix table { width: 100%; }
.verify-matrix thead th { font-size: 0.58rem; padding: 0.55rem 0.6rem; }
.verify-matrix tbody td { font-family: var(--mono); font-size: 0.67rem; padding: 0.5rem 0.6rem; }
.verify-matrix .check { color: var(--green); }
.verify-matrix .th-name { color: var(--text); }
/* SK */
.sk-bar { height: 4px; background: var(--accent); border-radius: 2px; transition: width 0.5s; display: inline-block; vertical-align: middle; margin-right: 0.4rem; }
/* SK DETAIL */
.sk-detail-block {
background: var(--surface2);
border: 1px solid rgba(244,160,23,0.2);
border-radius: 3px;
padding: 0.9rem 1.1rem;
font-family: var(--mono);
font-size: 0.68rem;
color: var(--muted);
line-height: 1.9;
margin-top: 1.2rem;
}
.sk-detail-block .sdk-title {
color: var(--gold);
font-size: 0.62rem;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
margin-bottom: 0.5rem;
}
/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
/* CERT */
.cert-layout { display: grid; grid-template-columns: 360px 1fr; gap: 2rem; }
.cert-input-box { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 1.4rem; }
.cert-input-box h3 { font-size: 0.85rem; font-weight: 700; margin-bottom: 0.9rem; }
.cert-output { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 1.4rem; min-height: 280px; }
.cert-status { display: flex; align-items: center; gap: 0.9rem; padding: 0.9rem 1.1rem; border-radius: 3px; margin-bottom: 1.3rem; border: 1px solid; }
.cert-status.valid { background: rgba(34,211,165,0.07); border-color: rgba(34,211,165,0.25); }
.cert-status.invalid { background: rgba(244,63,94,0.07); border-color: rgba(244,63,94,0.25); }
.cert-status .status-icon { font-size: 1.4rem; line-height: 1; }
.cert-status .status-text { font-family: var(--mono); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; }
.cert-status.valid .status-text { color: var(--green); }
.cert-status.invalid .status-text { color: var(--red); }
.pair-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 3px; padding: 0.9rem 1.1rem; margin-bottom: 0.6rem; }
.pair-card.pair-valid { border-left: 3px solid var(--green); }
.pair-card.pair-invalid { border-left: 3px solid var(--red); }
.pair-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.pair-spins { font-family: var(--mono); font-size: 0.85rem; font-weight: 700; }
.pair-verdict { font-family: var(--mono); font-size: 0.63rem; padding: 0.18rem 0.55rem; border-radius: 2px; }
.pair-verdict.ok { background: rgba(34,211,165,0.1); color: var(--green); }
.pair-verdict.fail { background: rgba(244,63,94,0.1); color: var(--red); }
.pair-channels { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.35rem; }
.channel-tag { font-family: var(--mono); font-size: 0.62rem; padding: 0.18rem 0.55rem; background: rgba(91,91,214,0.1); border: 1px solid rgba(91,91,214,0.25); border-radius: 2px; color: #a5b4fc; }
.pair-reason { font-family: var(--mono); font-size: 0.65rem; color: var(--muted); margin-top: 0.25rem; }
.btn { display: block; width: 100%; padding: 0.7rem; background: var(--accent); color: white; font-family: var(--mono); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; border: none; border-radius: 3px; cursor: pointer; transition: background 0.2s; margin-top: 0.4rem; }
.btn:hover { background: var(--accent2); }
/* plain explain box */
.plain-explain {
background: rgba(91,91,214,0.05);
border: 1px solid rgba(91,91,214,0.2);
border-radius: 3px;
padding: 0.9rem 1.1rem;
font-family: var(--mono);
font-size: 0.68rem;
color: var(--muted);
line-height: 1.8;
margin-top: 0.8rem;
}
.plain-explain .pe-title {
color: var(--cyan);
font-size: 0.6rem;
font-weight: 700;
letter-spacing: 0.15em;
text-transform: uppercase;
margin-bottom: 0.45rem;
}
.bop { font-family:var(--mono);font-size:0.72rem;padding:0.22rem 0.55rem;border-radius:2px;border:1px solid; }
.bop.s1 { color:#a5b4fc;border-color:rgba(165,180,252,0.4);background:rgba(165,180,252,0.07); }
.bop.s2 { color:var(--green);border-color:rgba(34,211,165,0.4);background:rgba(34,211,165,0.07); }
.bop.s1i { color:#c4b5fd;border-color:rgba(196,181,253,0.3);background:rgba(196,181,253,0.06); }
.bop.s2i { color:#6ee7b7;border-color:rgba(110,231,183,0.3);background:rgba(110,231,183,0.06); }
.step3b .cs-icon { background:linear-gradient(135deg,var(--gold),var(--orange)); }
@media (max-width: 1000px) {
header { padding: 1.4rem; flex-direction: column; }
main { padding: 1.4rem; }
.tab-bar { padding: 0 1.4rem; }
.compiler-layout { grid-template-columns: 1fr; }
.overview-grid { grid-template-columns: repeat(2, 1fr); }
.detail-grid { grid-template-columns: 1fr; }
.cert-layout { grid-template-columns: 1fr; }
.proof-grid { grid-template-columns: 1fr; }
.unitary-section { grid-template-columns: 1fr; }
.approx-metrics { grid-template-columns: 1fr 1fr; }
#bench-scorecard { grid-template-columns: repeat(2, 1fr); }
}
.bench-group { margin-bottom: 2rem; }
.bench-group-title { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.8rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.bench-row { display: flex; align-items: center; gap: 1rem; padding: 0.65rem 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 3px; margin-bottom: 0.4rem; }
.bench-row.pass { border-left: 3px solid var(--green); }
.bench-row.fail { border-left: 3px solid var(--red); }
.bench-row.warn { border-left: 3px solid var(--gold); }
.bench-name { font-family: var(--mono); font-size: 0.72rem; flex: 1; }
.bench-val { font-family: var(--mono); font-size: 0.7rem; color: var(--cyan); min-width: 120px; text-align: right; }
.bench-threshold { font-family: var(--mono); font-size: 0.62rem; color: var(--muted); min-width: 90px; text-align: right; }
.bench-icon { font-size: 0.9rem; width: 18px; text-align: center; flex-shrink: 0; }
.score-card { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 1rem; text-align: center; }
.score-card .sc-val { font-weight: 800; font-size: 1.6rem; font-family: var(--mono); }
.score-card .sc-label { font-family: var(--mono); font-size: 0.58rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 0.2rem; }
.score-card.exceptional .sc-val { color: var(--green); }
.score-card.good .sc-val { color: var(--gold); }
.score-card.poor .sc-val { color: var(--red); }
.val-tier { display: inline-block; font-family: var(--mono); font-size: 0.62rem; padding: 0.15rem 0.5rem; border-radius: 2px; margin-right: 0.4rem; }
.val-tier.high { background: rgba(34,211,165,0.1); color: var(--green); border: 1px solid rgba(34,211,165,0.3); }
.val-tier.mid { background: rgba(244,160,23,0.1); color: var(--gold); border: 1px solid rgba(244,160,23,0.3); }
.val-tier.low { background: rgba(104,104,168,0.1); color: var(--muted); border: 1px solid var(--border); }
@media (max-width: 1000px) {
.detail-grid { grid-template-columns: 1fr; }
.cert-layout { grid-template-columns: 1fr; }
.proof-grid { grid-template-columns: 1fr; }
.unitary-section { grid-template-columns: 1fr; }
.approx-metrics { grid-template-columns: 1fr 1fr; }
#bench-scorecard { grid-template-columns: repeat(2, 1fr); }
}
</style>
</head>
<body>
<header>
<div class="logo-block">
<h1>fiblib <span class="v2-badge">v5.5 COMPILER</span></h1>
<p class="tagline">Topological Quantum Gate Compiler · SU(2)_k WZW · k=1–10 · Fibonacci Anyons · Braid Synthesis + SK Refinement · Dual-Certificate Validity (Algebraic + Penrose)</p>
</div>
<div class="header-badges">
<span class="badge badge-green">✓ Exact Fibonacci R-symbols</span>
<span class="badge badge-cyan">True SK Group Commutator</span>
<span class="badge badge-gold">Real Pentagon Identity</span>
<span class="badge badge-orange">Dual-Certificate Validity</span>
<span class="badge badge-accent">Penrose ↔ WZW M-identity</span>
</div>
</header>
<div class="tab-bar">
<button class="tab compiler-tab active" onclick="showPanel('compiler', this)">⚙ Compiler</button>
<button class="tab" onclick="showPanel('overview', this)">Level Overview</button>
<button class="tab" onclick="showPanel('fusion', this)">Fusion Tables</button>
<button class="tab" onclick="showPanel('certificate', this)">Dual-Certificate</button>
<button class="tab" onclick="showPanel('theorems', this)">7 Theorems</button>
<button class="tab" onclick="showPanel('sk', this)">SK Convergence</button>
<button class="tab" onclick="showPanel('benchmark', this); runBenchmark();" style="color:var(--cyan);border-bottom:2px solid transparent;" id="bench-tab">📊 Benchmark Suite</button>
</div>
<main>
<!-- ═══════════════════════════════════════ COMPILER -->
<div id="panel-compiler" class="panel active">
<div class="section-label">Topological Quantum Compiler v5.4 — Full Pipeline (11 Bugs Fixed + 2 Structural Fixes)</div>
<h2>Gate Synthesis Engine</h2>
<span class="fix">✓ FIX 1:</span> φ⁻¹ display expression: corrected operator precedence — <code>2/(1+√5)</code> now explicit.<br>
<span class="fix">✓ FIX 2:</span> F-matrix for k≠3 now uses exact quantum 6j-symbols via q-deformed factorials (q=e^{iπ/(k+2)}), replacing the heuristic dimension-ratio approximation. All universal levels (k=5,7,9) now exact.<br>
<span class="fix">✓ FIX 3:</span> Solovay-Kitaev recursion replaced with true iterative group commutator construction: ε_n = c·ε_{n-1}^{3/2}, with explicit V_n = U_{n-1}·[Ã,B̃] group commutator and correct gate count O(log^{3.97}(1/ε)).<br>
<span class="fix">✓ FIX 4:</span> Pentagon identity check now computes the actual 5-move coherence equation (F⊗I)·F·(I⊗F) = F·F (Stasheff pentagon), not the trivial F·F†·F = F.<br>
<span class="fix">✓ FIX 5:</span> Basis completeness threshold tightened from 50% → 1% (|err| < 0.01).<br>
<span class="fix">✓ FIX 6:</span> Hexagon identity threshold tightened from 50% → 5% (err < 0.05), with exact R-channel routing.<br>
<span class="fix">✓ FIX 8 (v5):</span> <strong>phaseDist()</strong> replaced 200-point discrete phase scan with <strong>analytical optimum</strong>: φ* = arg(Σ B_ij·conj(A_ij)), giving exact minimum in O(1) rather than O(200n²). Eliminates quantisation error of ±π/100 that corrupted all distance measurements.<br>
<span class="fix">✓ FIX 9 (v5):</span> <strong>searchBraidWord()</strong> replaced naive LIFO DFS with <strong>iterative-deepening DFS (IDDFS)</strong> guaranteeing shortest braid words. Previous version found long suboptimal sequences, feeding SK a poor seed with ε₀≈1.4 instead of ≈0.1.<br>
<span class="fix">✓ FIX 10 (v5):</span> <strong>matSqrtSU2()</strong> had spurious extra <code>sinT</code> factor in off-diagonal terms (<code>scale*sinT</code> = <code>sinH/sinT * sinT</code> = <code>sinH</code> — was double-applying sinT). Now uses correct <code>cosH·I + i·sinH·(b·σ)</code> form.<br>
<span class="fix">✓ FIX 11 (v5):</span> <strong>solovayKitaevApprox()</strong> now actually updates currentU each iteration (v4 skipped update on n=0 and never fed improved U back into next step). subDepth fixed from <code>maxDepth-n→0</code> collapse to <code>min(maxDepth, max(4, maxDepth-n/2))</code>. SK reference table constant fixed from c=4 (diverges for ε₀>1/16) to c=0.97 empirical. Check #9 threshold corrected from 0.1→10⁻³ to match stated fault-tolerance requirement.<br>
<span class="fix">✓ FIX 12 (v5.4):</span> <strong>F[1,1] sign guard</strong> — benchmark now explicitly asserts F[1,1] = −φ⁻¹ = −0.61803… and confirms that the q6j path returns the wrong sign for this diagonal entry (it gives a positive value due to a phase convention mismatch). The k=3 hardcode in fMatrix() was already correct; the new test makes the dependency visible and prevents silent regression if the hardcode is removed.<br>
<span class="fix">✓ FIX 13 (v5.4):</span> <strong>k=2 Ising braid relation</strong> — root cause identified: the FIB_DATA/twist-formula phases for k=2 (−3π/4, +π/4) are <em>squared</em> braid eigenvalues (i.e. R = θ_c/θ_a/θ_b = eigenvalue of σ₁²), not the eigenvalues of σ₁ itself. The correct braid generator matrix is σ₁ = diag(e^{−3iπ/8}, e^{+iπ/8}) — the principal square roots — whose ratio e^{iπ/2} = i satisfies the Hadamard-F braid closure condition. σ₁² then recovers (−3π/4, +π/4) exactly. New Group 1b verifies the braid relation to < 10⁻¹⁴ and includes a σ₁² ↔ FIB_DATA consistency check. The FIB_DATA fusion table phases are unchanged and remain correct for their purpose (twist/R-phase display).<br>
</div>
<p class="subtitle">
Select a target gate, choose your anyon level, and compile. The engine runs the full pipeline: braid word synthesis with exact Fibonacci R-symbols → Solovay-Kitaev refinement → 10 verified error checks.
</p>
<div class="compiler-layout">
<!-- SIDEBAR -->
<div class="compiler-sidebar">
<div class="control-box">
<h3><span class="icon">①</span> Target Gate</h3>
<div class="field-group">
<label>Level k (anyon model)</label>
<select id="comp-k" onchange="updateCompilerPresets()">
<option value="3" selected>k = 3 — Fibonacci (τ, φ)</option>
<option value="2">k = 2 — Ising (σ anyon)</option>