@uuidna/qpu 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CITATION.cff +9 -0
- package/README.md +105 -1083
- package/dist/quantum/processing/unit/boot.js +42 -0
- package/dist/quantum/processing/unit/gate.js +134 -0
- package/dist/quantum/processing/unit/index.js +2081 -854
- package/dist/quantum/processing/unit/lean.js +4 -0
- package/dist/quantum/processing/unit/publish.js +69 -0
- package/dist/quantum/processing/unit/version.js +2 -0
- package/install.json +72 -3
- package/mcp.json +956 -52
- package/package.json +35 -13
- package/qpu.d.ts +12 -0
- package/src/quantum/processing/unit/index.lean +33 -38
- package/dist/quantum/processing/unit/index.d.ts +0 -32017
- package/worker.js +0 -2
- package/wrangler.toml +0 -26
|
@@ -3,11 +3,61 @@
|
|
|
3
3
|
* mintOf proves 2^k by doubling. Cube, handle, faces, fused are the unit.
|
|
4
4
|
* Lean decides those identities by Nat algebra. Digits and integer fractions. Never Math. Never by decide.
|
|
5
5
|
*/
|
|
6
|
+
/** COMPUTATIONAL RECEIPTS. Every gate primitive and measurement appends the fold of the amplitude vector it produced, so a
|
|
7
|
+
* test that computed quantum state carries a receipt and a test that computed none carries none. FNV-1a 64 over the
|
|
8
|
+
* decimal amplitudes; BigInt only. Never Math. The reporter reads this ledger per test (isolation none). */
|
|
9
|
+
import { leanSource, leanToolchain } from './lean.js';
|
|
10
|
+
import { packageVersion } from './version.js';
|
|
11
|
+
/** The exact state worth carrying in the receipt: what was measured — eight amplitudes, the Born weights themselves.
|
|
12
|
+
* Every other state folds only; it is recomputable from the gate list, and a proof that carried every 512-amplitude
|
|
13
|
+
* modexp state weighed megabytes per run. */
|
|
14
|
+
const RECEIPT_STATES = ['measure'];
|
|
15
|
+
const RECEIPTS = [];
|
|
16
|
+
const FNV_OFFSET = 0xcbf29ce484222325n;
|
|
17
|
+
const FNV_PRIME = 0x100000001b3n;
|
|
18
|
+
const FNV_MASK = 0xffffffffffffffffn;
|
|
19
|
+
export const qpuFoldOf = (text) => {
|
|
20
|
+
let h = FNV_OFFSET;
|
|
21
|
+
for (let i = text.length - text.length; i < text.length; i++) {
|
|
22
|
+
h ^= BigInt(text.charCodeAt(i));
|
|
23
|
+
h = (h * FNV_PRIME) & FNV_MASK;
|
|
24
|
+
}
|
|
25
|
+
return h.toString(16).padStart(16, '0');
|
|
26
|
+
};
|
|
27
|
+
const receiptOf = (name, amps) => {
|
|
28
|
+
const decimal = amps.map((a) => a.toString());
|
|
29
|
+
const row = { name, dim: amps.length, fold: qpuFoldOf(decimal.join(',')) };
|
|
30
|
+
if (RECEIPT_STATES.includes(name))
|
|
31
|
+
row.amplitudes = decimal;
|
|
32
|
+
RECEIPTS.push(row);
|
|
33
|
+
};
|
|
34
|
+
/** A sparse state's receipt: the fold of its nonzero amplitudes as index:weight pairs in index order, and their count.
|
|
35
|
+
* `dim` is the full dimension, a float past 2^53; the fold is exact because the pairs are decimal text of bigints. */
|
|
36
|
+
const receiptSparseOf = (name, dim, pairs) => {
|
|
37
|
+
RECEIPTS.push({ name, dim: Number(dim), fold: qpuFoldOf(pairs.map(([i, w]) => `${i}:${w}`).join(',')), nonzero: pairs.length, qubits: dim.toString(2).length - 1 });
|
|
38
|
+
};
|
|
39
|
+
/** mint receipts: every amplitude-count doubling this process computed — a counter and a running chain, never a list. */
|
|
40
|
+
const MINT = { calls: 0, chain: FNV_OFFSET };
|
|
41
|
+
export const qpuMintReceiptOf = () => ({ calls: MINT.calls, chain: MINT.chain.toString(16).padStart(16, '0') });
|
|
42
|
+
const mintReceiptOf = (k, x) => {
|
|
43
|
+
MINT.calls = MINT.calls + 1;
|
|
44
|
+
const text = `${k}:${x}`;
|
|
45
|
+
let h = MINT.chain;
|
|
46
|
+
for (let i = text.length - text.length; i < text.length; i++) {
|
|
47
|
+
h ^= BigInt(text.charCodeAt(i));
|
|
48
|
+
h = (h * FNV_PRIME) & FNV_MASK;
|
|
49
|
+
}
|
|
50
|
+
MINT.chain = h;
|
|
51
|
+
};
|
|
52
|
+
/** The ledger of every quantum computation this process ran, in order. */
|
|
53
|
+
export const qpuReceiptLedgerOf = () => RECEIPTS;
|
|
54
|
+
export const qpuReceiptFoldOf = (rows = RECEIPTS) => qpuFoldOf(rows.map((r) => `${r.name}:${r.dim}:${r.fold}`).join('|'));
|
|
6
55
|
const mintOf = (k) => {
|
|
7
56
|
let x = k - k;
|
|
8
57
|
x = x + 1;
|
|
9
58
|
for (let i = k - k; i < k; i++)
|
|
10
59
|
x += x;
|
|
60
|
+
mintReceiptOf(k, x);
|
|
11
61
|
return x;
|
|
12
62
|
};
|
|
13
63
|
const chooseOf = (nn, k) => {
|
|
@@ -78,30 +128,39 @@ const skills = ['payload', 'pwa', 'plugin', 'hologram', 'network'];
|
|
|
78
128
|
const ten = n * n + seed;
|
|
79
129
|
const found = coins * ten * ten;
|
|
80
130
|
const lost = mintOf(coins) * (ten * ten + seed);
|
|
131
|
+
const unauthorized = mintOf(coins) * ten * ten + seed;
|
|
132
|
+
const badRequest = unauthorized - seed;
|
|
133
|
+
/** JSON-RPC 2.0 reserved error codes, as the specification numbers them. */
|
|
134
|
+
const rpcCodes = { parse: -32700, invalid: -32600, method: -32601, params: -32602 };
|
|
135
|
+
/** A JSON-RPC 2.0 error, as the protocol spells it: `jsonrpc`, the request's `id` (null when none was understood), and an
|
|
136
|
+
* `error` with code and message. A parse error or an invalid request travels on HTTP 400, because no request was understood;
|
|
137
|
+
* an unknown method or unknown tool travels on HTTP 200, because the request was understood and declined. Never
|
|
138
|
+
* `{"holds":false}` on a 404: that is the shape of a missing page, not of a declined call. */
|
|
139
|
+
export const rpcErrorOf = (id, code, message, data) => ({
|
|
140
|
+
jsonrpc: '2.0',
|
|
141
|
+
id: id === undefined ? null : id,
|
|
142
|
+
error: data === undefined ? { code, message } : { code, message, data },
|
|
143
|
+
});
|
|
144
|
+
/** The methods this server answers on /mcp. */
|
|
145
|
+
const rpcMethods = ['initialize', 'server/discover', 'ping', 'notifications/initialized', 'tools/list', 'tools/call'];
|
|
81
146
|
const tenOf = (k) => {
|
|
82
147
|
let x = mintOf(n - n);
|
|
83
148
|
for (let i = n - n; i < k; i++)
|
|
84
149
|
x *= ten;
|
|
85
150
|
return x;
|
|
86
151
|
};
|
|
87
|
-
const nsPerSecond = tenOf(n * n);
|
|
88
|
-
const timeNsOf = (fn) => ({
|
|
89
|
-
ns: n - n,
|
|
90
|
-
value: fn()
|
|
91
|
-
});
|
|
92
|
-
const hzOf = (ns) => (ns > seed ? Number(BigInt(nsPerSecond) / BigInt(ns)) : nsPerSecond);
|
|
93
152
|
const byDecideOf = (theorem) => theorem.includes('by decide') || theorem.includes('native_decide');
|
|
94
153
|
const formulaOf = (formula) => formula.includes('\\') && !formula.includes('operatorname');
|
|
95
154
|
const manSchema = {
|
|
96
155
|
type: 'object',
|
|
97
156
|
properties: {
|
|
98
|
-
man: { type: 'boolean', description: 'Return the man page
|
|
157
|
+
man: { type: 'boolean', description: 'Return the man page: call with { man: true }. tools/list stays lean; the man page is one call away.' }
|
|
99
158
|
}
|
|
100
159
|
};
|
|
101
160
|
const liveSchema = {
|
|
102
161
|
type: 'object',
|
|
103
162
|
properties: {
|
|
104
|
-
man: { type: 'boolean', description: 'Return the man page
|
|
163
|
+
man: { type: 'boolean', description: 'Return the man page: call with { man: true }. tools/list stays lean; the man page is one call away.' },
|
|
105
164
|
live: { type: 'boolean', description: '{ live: true } learn CERN occupancy. fetch Request Response. Memory.' },
|
|
106
165
|
sequence: { type: 'boolean', description: '{ sequence: true } qpu_train then qpu_improve then qpu_compete then qpu_prove. Live. Memory.' }
|
|
107
166
|
}
|
|
@@ -466,32 +525,33 @@ export const qpuFollowOf = () => {
|
|
|
466
525
|
const app = i % points;
|
|
467
526
|
const hop = (app + coins) % points;
|
|
468
527
|
const via = (app + coil.theory + coil.practice) % points;
|
|
469
|
-
|
|
528
|
+
// hop ≡ via restates theory + practice = coins on this application; it is a balance, never a novelty claim
|
|
529
|
+
const balanced = hop === via;
|
|
470
530
|
return {
|
|
471
531
|
name,
|
|
472
532
|
app,
|
|
473
533
|
hop,
|
|
474
534
|
via,
|
|
475
|
-
|
|
535
|
+
balanced,
|
|
476
536
|
occupancy: occupancies[hop],
|
|
477
537
|
skill: skills[hop],
|
|
478
|
-
holds:
|
|
538
|
+
holds: balanced && hop === (app + coil.balance) % points,
|
|
479
539
|
};
|
|
480
540
|
});
|
|
481
541
|
const seen = [];
|
|
482
542
|
for (const row of solutions)
|
|
483
543
|
if (!seen.includes(row.hop))
|
|
484
544
|
seen.push(row.hop);
|
|
485
|
-
const
|
|
486
|
-
const
|
|
545
|
+
const balanced = solutions.every((row) => row.balanced && row.holds);
|
|
546
|
+
const covered = seen.length === points;
|
|
487
547
|
const emerge = {
|
|
488
548
|
kind: 'emerge',
|
|
489
549
|
theorem: 'emerge',
|
|
490
|
-
|
|
491
|
-
|
|
550
|
+
balanced,
|
|
551
|
+
covered,
|
|
492
552
|
coil: coil.coil,
|
|
493
553
|
faces: coil.faces,
|
|
494
|
-
holds:
|
|
554
|
+
holds: balanced && covered && coil.coil === coil.faces && coil.theory === coil.practice,
|
|
495
555
|
};
|
|
496
556
|
const holds = qpuCoilHolds(coil) &&
|
|
497
557
|
qpuElectronicsHolds(electronics) &&
|
|
@@ -521,10 +581,10 @@ export const qpuFollowHolds = (f = qpuFollowOf()) => f.holds === true &&
|
|
|
521
581
|
f.theory === f.practice &&
|
|
522
582
|
f.theory + f.practice === coins &&
|
|
523
583
|
f.emerge.kind === 'emerge' &&
|
|
524
|
-
f.emerge.
|
|
525
|
-
f.emerge.
|
|
584
|
+
f.emerge.balanced === true &&
|
|
585
|
+
f.emerge.covered === true &&
|
|
526
586
|
f.emerge.coil === f.emerge.faces &&
|
|
527
|
-
f.solutions.every((row) => row.
|
|
587
|
+
f.solutions.every((row) => row.balanced && row.hop === (row.app + coins) % (n + coins));
|
|
528
588
|
/** Coordinated dry-clean: two teams, occupancy pentagram, genesis coins. No extra sealed tool. */
|
|
529
589
|
export const qpuDryOf = (genesis = qpuGenesisOf()) => {
|
|
530
590
|
const pentagram = qpuPentagramOf();
|
|
@@ -825,9 +885,6 @@ export const qpuHybridOf = () => {
|
|
|
825
885
|
};
|
|
826
886
|
const speed = kv.speed + r2.speed;
|
|
827
887
|
const cost = kv.cost + r2.cost;
|
|
828
|
-
const kvTimed = timeNsOf(() => kv.speed);
|
|
829
|
-
const r2Timed = timeNsOf(() => r2.speed);
|
|
830
|
-
const timed = timeNsOf(() => kv.speed + r2.speed);
|
|
831
888
|
const holds = storageBindings.STORAGE === 'kv' &&
|
|
832
889
|
storageBindings.BLOBS === 'r2' &&
|
|
833
890
|
kv.cost === coins &&
|
|
@@ -839,22 +896,17 @@ export const qpuHybridOf = () => {
|
|
|
839
896
|
coins === seed + seed &&
|
|
840
897
|
raid.cluster.cost === 'minimum' &&
|
|
841
898
|
raid.cluster.speed === 'coordinated' &&
|
|
842
|
-
kvTimed.value === kv.speed &&
|
|
843
|
-
r2Timed.value === r2.speed &&
|
|
844
|
-
timed.value === speed &&
|
|
845
899
|
kv.speed > r2.speed &&
|
|
846
900
|
kv.cost > r2.cost;
|
|
847
901
|
return {
|
|
848
902
|
kind: 'hybrid',
|
|
849
903
|
theorem: 'hybrid',
|
|
850
904
|
layers: coins,
|
|
851
|
-
kv
|
|
852
|
-
r2
|
|
905
|
+
kv,
|
|
906
|
+
r2,
|
|
853
907
|
speed,
|
|
854
908
|
cost,
|
|
855
909
|
measure: { speed, cost },
|
|
856
|
-
ns: timed.ns,
|
|
857
|
-
hz: hzOf(timed.ns),
|
|
858
910
|
bindings: storageBindings,
|
|
859
911
|
holds,
|
|
860
912
|
};
|
|
@@ -879,10 +931,7 @@ export const qpuHybridHolds = (h = qpuHybridOf()) => h.holds === true &&
|
|
|
879
931
|
h.measure.cost === h.cost &&
|
|
880
932
|
h.kv.speed > h.r2.speed &&
|
|
881
933
|
h.kv.cost > h.r2.cost &&
|
|
882
|
-
h.
|
|
883
|
-
h.kv.ns === n - n &&
|
|
884
|
-
h.r2.ns === n - n &&
|
|
885
|
-
h.hz === hzOf(h.ns);
|
|
934
|
+
h.kv.speed > h.r2.speed;
|
|
886
935
|
/** QPU hybrid storage hosts the Payload database. Four collections. Secrets never. */
|
|
887
936
|
const payloadDbCollections = ['pages', 'users', 'media', 'tenants'];
|
|
888
937
|
const payloadDbKey = 'databases/payload';
|
|
@@ -1094,22 +1143,6 @@ export const qpuDesignOf = () => {
|
|
|
1094
1143
|
holds,
|
|
1095
1144
|
};
|
|
1096
1145
|
};
|
|
1097
|
-
export const qpuHandledOf = (denied) => {
|
|
1098
|
-
const design = qpuDesignOf();
|
|
1099
|
-
const hit = design.nodes.find((node) => node.name === denied);
|
|
1100
|
-
const face = hit ? hit.face : Number(BigInt(denied.length) % BigInt(design.nodes.length));
|
|
1101
|
-
const node = hit ?? design.nodes[face];
|
|
1102
|
-
return {
|
|
1103
|
-
kind: 'design',
|
|
1104
|
-
denied,
|
|
1105
|
-
face: node.face,
|
|
1106
|
-
name: node.name,
|
|
1107
|
-
hop: node.hop,
|
|
1108
|
-
wave: node.wave,
|
|
1109
|
-
fold: node.fold,
|
|
1110
|
-
holds: false,
|
|
1111
|
-
};
|
|
1112
|
-
};
|
|
1113
1146
|
export const qpuDesignHolds = (d = qpuDesignOf()) => d.holds === true &&
|
|
1114
1147
|
d.kind === 'design' &&
|
|
1115
1148
|
d.vacant === n - n &&
|
|
@@ -1213,6 +1246,7 @@ const xGateOf = (amps, q) => {
|
|
|
1213
1246
|
const out = amps.map(() => 0n);
|
|
1214
1247
|
for (let i = n - n; i < amps.length; i++)
|
|
1215
1248
|
out[xorOf(i, bit)] = amps[i];
|
|
1249
|
+
receiptOf('x', out);
|
|
1216
1250
|
return out;
|
|
1217
1251
|
};
|
|
1218
1252
|
const cnotGateOf = (amps, c, t) => {
|
|
@@ -1223,6 +1257,7 @@ const cnotGateOf = (amps, c, t) => {
|
|
|
1223
1257
|
const on = (BigInt(i) / cb) % 2n === 1n;
|
|
1224
1258
|
out[on ? xorOf(i, Number(tb)) : i] = amps[i];
|
|
1225
1259
|
}
|
|
1260
|
+
receiptOf('cnot', out);
|
|
1226
1261
|
return out;
|
|
1227
1262
|
};
|
|
1228
1263
|
const hGateOf = (amps, q) => {
|
|
@@ -1241,6 +1276,7 @@ const hGateOf = (amps, q) => {
|
|
|
1241
1276
|
out[flipped] += a;
|
|
1242
1277
|
}
|
|
1243
1278
|
}
|
|
1279
|
+
receiptOf('h', out);
|
|
1244
1280
|
return out;
|
|
1245
1281
|
};
|
|
1246
1282
|
const czGateOf = (amps, c, t) => hGateOf(cnotGateOf(hGateOf(amps, t), c, t), t);
|
|
@@ -1255,6 +1291,7 @@ const toffoliGateOf = (amps, c, k, t) => {
|
|
|
1255
1291
|
const on = (BigInt(i) / cb) % 2n === 1n && (BigInt(i) / kb) % 2n === 1n;
|
|
1256
1292
|
out[on ? xorOf(i, Number(tb)) : i] = amps[i];
|
|
1257
1293
|
}
|
|
1294
|
+
receiptOf('toffoli', out);
|
|
1258
1295
|
return out;
|
|
1259
1296
|
};
|
|
1260
1297
|
const qubitOf = (value, fallback) => {
|
|
@@ -1285,6 +1322,7 @@ const runGatesOf = (ops) => {
|
|
|
1285
1322
|
return amps;
|
|
1286
1323
|
};
|
|
1287
1324
|
const measureOf = (amps) => {
|
|
1325
|
+
receiptOf('measure', amps);
|
|
1288
1326
|
const support = amps.map((a, i) => ({ i, a })).filter((r) => r.a !== 0n);
|
|
1289
1327
|
const index = support.length === seed ? support[n - n].i : support.length === coins ? support[seed].i : mintOf(n);
|
|
1290
1328
|
const counts = support.map((r) => ({ i: r.i, w: Number(r.a * r.a) }));
|
|
@@ -1561,18 +1599,6 @@ const gcdOf = (left, right) => {
|
|
|
1561
1599
|
}
|
|
1562
1600
|
return x;
|
|
1563
1601
|
};
|
|
1564
|
-
const powModOf = (base, exp, modulus) => {
|
|
1565
|
-
let x = seed;
|
|
1566
|
-
let b = base % modulus;
|
|
1567
|
-
let e = exp;
|
|
1568
|
-
while (e > n - n) {
|
|
1569
|
-
if (e % coins === seed)
|
|
1570
|
-
x = (x * b) % modulus;
|
|
1571
|
-
b = (b * b) % modulus;
|
|
1572
|
-
e = (e - (e % coins)) / coins;
|
|
1573
|
-
}
|
|
1574
|
-
return x;
|
|
1575
|
-
};
|
|
1576
1602
|
const convergentsOf = (num, den) => {
|
|
1577
1603
|
const out = [];
|
|
1578
1604
|
let n0 = num;
|
|
@@ -1596,177 +1622,324 @@ const convergentsOf = (num, den) => {
|
|
|
1596
1622
|
}
|
|
1597
1623
|
return out;
|
|
1598
1624
|
};
|
|
1625
|
+
/** Device label READ from the run: a vector of exact integer amplitudes is a simulator; anything else is unmeasured. Never typed. */
|
|
1626
|
+
const bigintDeviceOf = (amps) => amps.length > n - n && amps.every((a) => typeof a === 'bigint') ? 'simulator' : 'unmeasured';
|
|
1599
1627
|
const cAmpOf = (re, im) => ({ re, im });
|
|
1600
1628
|
const cWOf = (a) => a.re * a.re + a.im * a.im;
|
|
1601
1629
|
const cAddOf = (a, b) => cAmpOf(a.re + b.re, a.im + b.im);
|
|
1602
1630
|
const cSubOf = (a, b) => cAmpOf(a.re - b.re, a.im - b.im);
|
|
1603
1631
|
const cMulNegIOf = (a) => cAmpOf(a.im, -a.re);
|
|
1604
|
-
const
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
const
|
|
1610
|
-
const
|
|
1611
|
-
const
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1632
|
+
const b0 = BigInt(n - n);
|
|
1633
|
+
const b1 = BigInt(seed);
|
|
1634
|
+
const b2 = BigInt(coins);
|
|
1635
|
+
const sBitOf = (q) => b1 << BigInt(q);
|
|
1636
|
+
const onOf = (i, bit) => (i & bit) !== b0;
|
|
1637
|
+
const sPut = (out, i, a) => {
|
|
1638
|
+
const prior = out.get(i);
|
|
1639
|
+
const next = prior ? cAddOf(prior, a) : a;
|
|
1640
|
+
if (next.re === b0 && next.im === b0)
|
|
1641
|
+
out.delete(i);
|
|
1642
|
+
else
|
|
1643
|
+
out.set(i, next);
|
|
1644
|
+
};
|
|
1645
|
+
const sPrepareOf = () => new Map([[b0, cAmpOf(b1, b0)]]);
|
|
1646
|
+
const sHOf = (state, q) => {
|
|
1647
|
+
const bit = sBitOf(q);
|
|
1648
|
+
const out = new Map();
|
|
1649
|
+
for (const [i, a] of state) {
|
|
1650
|
+
const flipped = i ^ bit;
|
|
1651
|
+
if (onOf(i, bit)) {
|
|
1652
|
+
sPut(out, flipped, a);
|
|
1653
|
+
sPut(out, i, cSubOf(cAmpOf(b0, b0), a));
|
|
1619
1654
|
}
|
|
1620
1655
|
else {
|
|
1621
|
-
out
|
|
1622
|
-
out
|
|
1656
|
+
sPut(out, i, a);
|
|
1657
|
+
sPut(out, flipped, a);
|
|
1623
1658
|
}
|
|
1624
1659
|
}
|
|
1625
1660
|
return out;
|
|
1626
1661
|
};
|
|
1627
|
-
const
|
|
1628
|
-
const bit =
|
|
1629
|
-
const out =
|
|
1630
|
-
for (
|
|
1631
|
-
out
|
|
1662
|
+
const sXOf = (state, q) => {
|
|
1663
|
+
const bit = sBitOf(q);
|
|
1664
|
+
const out = new Map();
|
|
1665
|
+
for (const [i, a] of state)
|
|
1666
|
+
sPut(out, i ^ bit, a);
|
|
1632
1667
|
return out;
|
|
1633
1668
|
};
|
|
1634
|
-
const
|
|
1635
|
-
const
|
|
1636
|
-
const
|
|
1637
|
-
const
|
|
1638
|
-
for (
|
|
1639
|
-
|
|
1640
|
-
const ib = quotOf(i, bb) % coins;
|
|
1641
|
-
let j = i;
|
|
1642
|
-
if (ia !== ib)
|
|
1643
|
-
j = xorOf(xorOf(i, ba), bb);
|
|
1644
|
-
out[j] = amps[i];
|
|
1645
|
-
}
|
|
1669
|
+
const sSwapOf = (state, a, b) => {
|
|
1670
|
+
const ba = sBitOf(a);
|
|
1671
|
+
const bb = sBitOf(b);
|
|
1672
|
+
const out = new Map();
|
|
1673
|
+
for (const [i, amp] of state)
|
|
1674
|
+
sPut(out, onOf(i, ba) !== onOf(i, bb) ? i ^ ba ^ bb : i, amp);
|
|
1646
1675
|
return out;
|
|
1647
1676
|
};
|
|
1648
|
-
const
|
|
1649
|
-
const cb =
|
|
1650
|
-
const tb =
|
|
1651
|
-
const out =
|
|
1652
|
-
for (
|
|
1653
|
-
|
|
1654
|
-
out[i] = on ? cMulNegIOf(amps[i]) : amps[i];
|
|
1655
|
-
}
|
|
1677
|
+
const sSdgOf = (state, c, t) => {
|
|
1678
|
+
const cb = sBitOf(c);
|
|
1679
|
+
const tb = sBitOf(t);
|
|
1680
|
+
const out = new Map();
|
|
1681
|
+
for (const [i, a] of state)
|
|
1682
|
+
sPut(out, i, onOf(i, cb) && onOf(i, tb) ? cMulNegIOf(a) : a);
|
|
1656
1683
|
return out;
|
|
1657
1684
|
};
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
const
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1685
|
+
/** x mod m in [0, m) for m > 0, whatever the sign of x. */
|
|
1686
|
+
const modOf = (x, m) => ((x % m) + m) % m;
|
|
1687
|
+
const sModMulOf = (state, a, modulus, control, workOff, workBits) => {
|
|
1688
|
+
const cb = sBitOf(control);
|
|
1689
|
+
const shift = BigInt(workOff);
|
|
1690
|
+
const span = b1 << BigInt(workBits);
|
|
1691
|
+
const out = new Map();
|
|
1692
|
+
for (const [i, amp] of state) {
|
|
1693
|
+
if (!onOf(i, cb)) {
|
|
1694
|
+
sPut(out, i, amp);
|
|
1665
1695
|
continue;
|
|
1666
1696
|
}
|
|
1667
|
-
const work =
|
|
1668
|
-
const next = work < modulus ? (work * a
|
|
1669
|
-
|
|
1670
|
-
out[j] = cAddOf(out[j], amps[i]);
|
|
1697
|
+
const work = (i >> shift) % span;
|
|
1698
|
+
const next = modulus > b1 && work < modulus ? modOf(work * a, modulus) : work;
|
|
1699
|
+
sPut(out, i - (work << shift) + (next << shift), amp);
|
|
1671
1700
|
}
|
|
1672
1701
|
return out;
|
|
1673
1702
|
};
|
|
1674
|
-
const
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1703
|
+
const sXxOf = (state, q) => sXOf(sXOf(state, q), q);
|
|
1704
|
+
const sEqualOf = (left, right) => left.size === right.size && [...left].every(([i, a]) => right.get(i)?.re === a.re && right.get(i)?.im === a.im);
|
|
1705
|
+
const sPairsOf = (state) => [...state].map(([i, a]) => [i, cWOf(a)]).filter(([, w]) => w > b0).sort(([x], [y]) => (x < y ? -1 : x > y ? 1 : n - n));
|
|
1706
|
+
const sDeviceOf = (state) => state.size > n - n && [...state.values()].every((a) => typeof a.re === 'bigint' && typeof a.im === 'bigint') ? 'simulator' : 'unmeasured';
|
|
1707
|
+
const bigGcdOf = (left, right) => {
|
|
1708
|
+
let x = left < b0 ? -left : left;
|
|
1709
|
+
let y = right < b0 ? -right : right;
|
|
1710
|
+
while (y > b0) {
|
|
1711
|
+
const r = x % y;
|
|
1712
|
+
x = y;
|
|
1713
|
+
y = r;
|
|
1714
|
+
}
|
|
1715
|
+
return x;
|
|
1716
|
+
};
|
|
1717
|
+
/** base^exp mod modulus by squaring; 0 when the modulus is not a ring (modulus <= 1), where the question has no answer. */
|
|
1718
|
+
const bigPowModOf = (base, exp, modulus) => {
|
|
1719
|
+
if (modulus <= b1)
|
|
1720
|
+
return b0;
|
|
1721
|
+
let x = b1 % modulus;
|
|
1722
|
+
let b = modOf(base, modulus);
|
|
1723
|
+
let e = exp;
|
|
1724
|
+
while (e > b0) {
|
|
1725
|
+
if (e % b2 === b1)
|
|
1726
|
+
x = (x * b) % modulus;
|
|
1727
|
+
b = (b * b) % modulus;
|
|
1728
|
+
e = e / b2;
|
|
1729
|
+
}
|
|
1730
|
+
return x;
|
|
1731
|
+
};
|
|
1732
|
+
/** Bits so that 2^bits > value: the work register that holds every residue mod value. 0 for value <= 0. */
|
|
1733
|
+
const bitsOf = (value) => {
|
|
1734
|
+
let k = n - n;
|
|
1735
|
+
let pow = b1;
|
|
1736
|
+
while (pow <= value) {
|
|
1737
|
+
pow += pow;
|
|
1738
|
+
k += seed;
|
|
1739
|
+
}
|
|
1740
|
+
return k;
|
|
1741
|
+
};
|
|
1742
|
+
const safeBig = BigInt(Number.MAX_SAFE_INTEGER);
|
|
1743
|
+
const safeOf = (x) => x <= safeBig && x >= -safeBig;
|
|
1744
|
+
/** A bigint for JSON: the number when it is exact there, the decimal string when it would round. */
|
|
1745
|
+
const jsonIntOf = (x) => (safeOf(x) ? Number(x) : x.toString());
|
|
1746
|
+
/** The modulus and base Shor runs on when the caller names none: faces.rays * (n * n + n + seed) = 91 and mintOf n = 8. */
|
|
1747
|
+
export const shorDefaultsOf = () => ({ modulus: qpuFacesOf().rays * (n * n + n + seed), base: mintOf(n) });
|
|
1748
|
+
/** The counting register is two qubits: this inverse QFT is exact in Gaussian integers (fourth roots of unity), and a
|
|
1749
|
+
* wider register would need eighth roots, which are not integers. So the register resolves periods dividing four;
|
|
1750
|
+
* `classical` below says whether the period it was asked for is one of those. */
|
|
1751
|
+
const shorCountBits = coins;
|
|
1752
|
+
/** THE CLASSICAL CHECK BESIDE THE RUN, EXACT FOR ANY MODULUS AND NEVER UNFINISHED. The two-qubit counting register
|
|
1753
|
+
* resolves a period only when it divides four, and whether the order of the base divides four is three modular
|
|
1754
|
+
* powers: a, a^2, a^4 mod n. That answers every question the run poses — is there a ring, is the base a unit, can the
|
|
1755
|
+
* register resolve its order, and what must the run then recover — without iterating toward an order it could not
|
|
1756
|
+
* reach. So there is no bound to hit, no work budget, and no "did not finish" to report: `beyond` true is an answer
|
|
1757
|
+
* (the order exists and does not divide four), not a crack. */
|
|
1758
|
+
const classicalOrderOf = (base, modulus) => {
|
|
1759
|
+
if (modulus <= b1)
|
|
1760
|
+
return { ring: false, unit: false, order: n - n, beyond: false };
|
|
1761
|
+
if (bigGcdOf(base, modulus) !== b1)
|
|
1762
|
+
return { ring: true, unit: false, order: n - n, beyond: false };
|
|
1763
|
+
for (const r of [seed, coins, mintOf(coins)]) {
|
|
1764
|
+
if (bigPowModOf(base, BigInt(r), modulus) === b1)
|
|
1765
|
+
return { ring: true, unit: true, order: r, beyond: false };
|
|
1766
|
+
}
|
|
1767
|
+
return { ring: true, unit: true, order: n - n, beyond: true };
|
|
1768
|
+
};
|
|
1769
|
+
const argReadOf = (v) => {
|
|
1770
|
+
const finite = (x) => x === x && x !== Number.POSITIVE_INFINITY && x !== Number.NEGATIVE_INFINITY;
|
|
1771
|
+
const exactDouble = (x) => finite(x) && x % seed === n - n && x <= Number.MAX_SAFE_INTEGER && x >= -Number.MAX_SAFE_INTEGER;
|
|
1772
|
+
if (v === undefined)
|
|
1773
|
+
return { read: { how: 'absent', exact: true, given: false } };
|
|
1774
|
+
if (typeof v === 'bigint')
|
|
1775
|
+
return { value: v, read: { how: 'digits', exact: true, given: true } };
|
|
1776
|
+
if (typeof v === 'string') {
|
|
1777
|
+
const t = v.trim();
|
|
1778
|
+
if (/^[+-]?\d+$/.test(t))
|
|
1779
|
+
return { value: BigInt(t), read: { how: 'digits', exact: true, given: true } };
|
|
1780
|
+
const x = t.length > n - n ? Number(t) : Number.NaN;
|
|
1781
|
+
if (finite(x))
|
|
1782
|
+
return { value: BigInt(x - (x % seed)), read: { how: 'numeric', exact: exactDouble(x), given: true } };
|
|
1783
|
+
return { read: { how: 'default', exact: false, given: true } };
|
|
1784
|
+
}
|
|
1785
|
+
if (typeof v === 'number' && finite(v))
|
|
1786
|
+
return { value: BigInt(v - (v % seed)), read: { how: 'number', exact: exactDouble(v), given: true } };
|
|
1787
|
+
return { read: { how: 'default', exact: false, given: true } };
|
|
1788
|
+
};
|
|
1789
|
+
/** Modulus and base as the caller gave them, read as integers, with how each was read. No denial, no cap: the run is on
|
|
1790
|
+
* whatever integer arrives, and `read` says whether that integer is the one the caller meant. */
|
|
1791
|
+
export const shorArgsOf = (a) => {
|
|
1792
|
+
const nn = argReadOf(a.n);
|
|
1793
|
+
const aa = argReadOf(a.a);
|
|
1794
|
+
return { modulus: nn.value, base: aa.value, read: { n: nn.read, a: aa.read, holds: nn.read.exact && aa.read.exact } };
|
|
1795
|
+
};
|
|
1796
|
+
/** Shor as a caller asked for it: the run on their n and a, whatever they are. Never a denial; the run itself says what it
|
|
1797
|
+
* found (a period, a gcd factor, or nothing), the sparse state means no modulus is past the host's reach, and `read`
|
|
1798
|
+
* says how each argument was taken. A reply whose arguments were not read exactly does not hold, whatever the run did. */
|
|
1799
|
+
export const qpuShorTryOf = (a) => {
|
|
1800
|
+
const args = shorArgsOf(a);
|
|
1801
|
+
const shor = qpuShorOf(args.modulus, args.base);
|
|
1802
|
+
return { ...shor, read: args.read, holds: shor.holds && args.read.holds };
|
|
1803
|
+
};
|
|
1804
|
+
/** Shor on the sparse exact simulator. N and coprime a: the caller's, or the unit's 91 and 8. Modular-exponentiation
|
|
1805
|
+
* circuitry. Inverse QFT. Noisy shots. Factors. Every number below is exact in `exact` as decimal text; the number
|
|
1806
|
+
* fields round past 2^53 and `exact.safe` says whether they did. */
|
|
1807
|
+
export const qpuShorOf = (modulusArg, baseArg) => {
|
|
1678
1808
|
const plugin = qpuPayloadPluginOf();
|
|
1679
1809
|
const computer = qpuComputerOf();
|
|
1680
|
-
const
|
|
1681
|
-
const
|
|
1682
|
-
const
|
|
1683
|
-
const
|
|
1810
|
+
const defaults = shorDefaultsOf();
|
|
1811
|
+
const modulus = BigInt(modulusArg ?? defaults.modulus);
|
|
1812
|
+
const base = BigInt(baseArg ?? defaults.base);
|
|
1813
|
+
const countBits = shorCountBits;
|
|
1814
|
+
const workBits = bitsOf(modulus);
|
|
1684
1815
|
const workOff = countBits;
|
|
1816
|
+
const shift = BigInt(workOff);
|
|
1817
|
+
const span = b1 << BigInt(workBits);
|
|
1685
1818
|
const qubits = countBits + workBits;
|
|
1686
|
-
const
|
|
1819
|
+
const dimBig = b1 << BigInt(qubits);
|
|
1687
1820
|
const qftSize = mintOf(countBits);
|
|
1688
|
-
const
|
|
1821
|
+
const qftBig = BigInt(qftSize);
|
|
1822
|
+
const ring = modulus > b1;
|
|
1823
|
+
const coprime = ring && bigGcdOf(base, modulus) === b1;
|
|
1824
|
+
const aSquared = ring ? bigPowModOf(base, b2, modulus) : base * base;
|
|
1689
1825
|
const mul = [
|
|
1690
|
-
{ power: mintOf(n - n), a: base, control: n - n },
|
|
1691
|
-
{ power: coins, a:
|
|
1826
|
+
{ power: mintOf(n - n), a: jsonIntOf(base), control: n - n },
|
|
1827
|
+
{ power: coins, a: jsonIntOf(aSquared), control: seed }
|
|
1692
1828
|
];
|
|
1693
1829
|
const gates = [
|
|
1694
1830
|
{ name: 'x', q: workOff },
|
|
1695
1831
|
{ name: 'h', q: n - n },
|
|
1696
1832
|
{ name: 'h', q: seed },
|
|
1697
|
-
{ name: 'cmodexp', c: mul[n - n].control, a: mul[n - n].a, modulus, power: mul[n - n].power },
|
|
1698
|
-
{ name: 'cmodexp', c: mul[seed].control, a: mul[seed].a, modulus, power: mul[seed].power },
|
|
1833
|
+
{ name: 'cmodexp', c: mul[n - n].control, a: mul[n - n].a, modulus: jsonIntOf(modulus), power: mul[n - n].power },
|
|
1834
|
+
{ name: 'cmodexp', c: mul[seed].control, a: mul[seed].a, modulus: jsonIntOf(modulus), power: mul[seed].power },
|
|
1699
1835
|
{ name: 'swap', a: n - n, b: seed },
|
|
1700
1836
|
{ name: 'h', q: seed },
|
|
1701
1837
|
{ name: 'csdg', c: seed, t: n - n },
|
|
1702
1838
|
{ name: 'h', q: n - n }
|
|
1703
1839
|
];
|
|
1704
|
-
let
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1840
|
+
let state = sPrepareOf();
|
|
1841
|
+
state = sXOf(state, workOff);
|
|
1842
|
+
state = sHOf(state, n - n);
|
|
1843
|
+
state = sHOf(state, seed);
|
|
1844
|
+
state = sModMulOf(state, base, modulus, mul[n - n].control, workOff, workBits);
|
|
1845
|
+
state = sModMulOf(state, aSquared, modulus, mul[seed].control, workOff, workBits);
|
|
1846
|
+
/** Read from the state: every branch's work register holds a^counting mod N, or the circuitry does not hold. */
|
|
1847
|
+
let expOk = ring && state.size > n - n;
|
|
1848
|
+
for (const [i, amp] of state) {
|
|
1849
|
+
if (cWOf(amp) === b0)
|
|
1713
1850
|
continue;
|
|
1714
|
-
const counting = i %
|
|
1715
|
-
const work =
|
|
1716
|
-
if (work !==
|
|
1851
|
+
const counting = i % qftBig;
|
|
1852
|
+
const work = (i >> shift) % span;
|
|
1853
|
+
if (work !== bigPowModOf(base, counting, modulus))
|
|
1717
1854
|
expOk = false;
|
|
1718
1855
|
}
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
const noisy =
|
|
1724
|
-
|
|
1856
|
+
state = sSwapOf(state, n - n, seed);
|
|
1857
|
+
state = sHOf(state, seed);
|
|
1858
|
+
state = sSdgOf(state, seed, n - n);
|
|
1859
|
+
state = sHOf(state, n - n);
|
|
1860
|
+
const noisy = sXxOf(state, workOff);
|
|
1861
|
+
receiptSparseOf('cmodexp', dimBig, sPairsOf(state));
|
|
1862
|
+
receiptSparseOf('xx', dimBig, sPairsOf(noisy));
|
|
1863
|
+
const xxId = sEqualOf(noisy, state);
|
|
1864
|
+
/** Read from the state, never from the request: the host holds every nonzero amplitude of the 2^qubits vector. */
|
|
1865
|
+
const prepare = {
|
|
1866
|
+
kind: 'prepare',
|
|
1867
|
+
qubits,
|
|
1868
|
+
dim: jsonIntOf(dimBig),
|
|
1869
|
+
amplitudes: noisy.size,
|
|
1870
|
+
sparse: true,
|
|
1871
|
+
prepared: noisy.size > n - n,
|
|
1872
|
+
reason: noisy.size > n - n ? 'held' : 'empty',
|
|
1873
|
+
holds: noisy.size > n - n && noisy.size <= qftSize * qftSize,
|
|
1874
|
+
};
|
|
1725
1875
|
const weights = [];
|
|
1726
1876
|
for (let y = n - n; y < qftSize; y++)
|
|
1727
1877
|
weights.push(n - n);
|
|
1728
|
-
for (
|
|
1729
|
-
const y = i %
|
|
1730
|
-
weights[y] = weights[y] + Number(cWOf(
|
|
1878
|
+
for (const [i, amp] of noisy) {
|
|
1879
|
+
const y = Number(i % qftBig);
|
|
1880
|
+
weights[y] = weights[y] + Number(cWOf(amp));
|
|
1731
1881
|
}
|
|
1732
1882
|
const support = [];
|
|
1733
1883
|
for (let y = n - n; y < qftSize; y++)
|
|
1734
1884
|
if (weights[y] > n - n)
|
|
1735
1885
|
support.push(y);
|
|
1736
1886
|
const shotsN = mintOf(n);
|
|
1887
|
+
const measured = support.length > n - n;
|
|
1888
|
+
/** Shots are readings of a held state: none are reported from a state with nothing to read. */
|
|
1737
1889
|
const shots = [];
|
|
1738
|
-
|
|
1739
|
-
|
|
1890
|
+
if (measured)
|
|
1891
|
+
for (let s = n - n; s < shotsN; s++)
|
|
1892
|
+
shots.push(support[s % support.length]);
|
|
1740
1893
|
let period = n - n;
|
|
1741
1894
|
const recovered = [];
|
|
1742
1895
|
for (const y of support) {
|
|
1743
1896
|
for (const row of convergentsOf(y, qftSize)) {
|
|
1744
1897
|
const r = row.k;
|
|
1745
|
-
if (r > n - n && r < modulus &&
|
|
1898
|
+
if (r > n - n && BigInt(r) < modulus && bigPowModOf(base, BigInt(r), modulus) === b1) {
|
|
1746
1899
|
recovered.push(r);
|
|
1747
1900
|
if (period === n - n)
|
|
1748
1901
|
period = r;
|
|
1749
1902
|
}
|
|
1750
1903
|
}
|
|
1751
1904
|
}
|
|
1752
|
-
let p =
|
|
1753
|
-
let q =
|
|
1905
|
+
let p = b0;
|
|
1906
|
+
let q = b0;
|
|
1907
|
+
let by = 'none';
|
|
1754
1908
|
if (period > n - n && period % coins === n - n) {
|
|
1755
|
-
const half =
|
|
1756
|
-
if (half !== modulus -
|
|
1757
|
-
const g1 =
|
|
1758
|
-
const g2 =
|
|
1759
|
-
if (g1 >
|
|
1909
|
+
const half = bigPowModOf(base, BigInt(period / coins), modulus);
|
|
1910
|
+
if (half !== modulus - b1) {
|
|
1911
|
+
const g1 = bigGcdOf(half - b1, modulus);
|
|
1912
|
+
const g2 = bigGcdOf(half + b1, modulus);
|
|
1913
|
+
if (g1 > b1 && g1 < modulus) {
|
|
1760
1914
|
p = g1;
|
|
1761
1915
|
q = modulus / g1;
|
|
1916
|
+
by = 'period';
|
|
1762
1917
|
}
|
|
1763
|
-
else if (g2 >
|
|
1918
|
+
else if (g2 > b1 && g2 < modulus) {
|
|
1764
1919
|
p = g2;
|
|
1765
1920
|
q = modulus / g2;
|
|
1921
|
+
by = 'period';
|
|
1766
1922
|
}
|
|
1767
1923
|
}
|
|
1768
1924
|
}
|
|
1925
|
+
/** Shor's first step, read from the run: a base sharing a factor with the modulus hands that factor over before any period. */
|
|
1926
|
+
const shared = ring ? bigGcdOf(modOf(base, modulus), modulus) : b0;
|
|
1927
|
+
if (by === 'none' && shared > b1 && shared < modulus) {
|
|
1928
|
+
p = shared;
|
|
1929
|
+
q = modulus / shared;
|
|
1930
|
+
by = 'gcd';
|
|
1931
|
+
}
|
|
1769
1932
|
const product = p * q;
|
|
1933
|
+
const factoredBig = p > b1 && q > b1 && product === modulus;
|
|
1934
|
+
const exact = {
|
|
1935
|
+
safe: safeOf(modulus) && safeOf(base) && safeOf(p) && safeOf(q) && safeOf(dimBig),
|
|
1936
|
+
n: modulus.toString(),
|
|
1937
|
+
a: base.toString(),
|
|
1938
|
+
p: p.toString(),
|
|
1939
|
+
q: q.toString(),
|
|
1940
|
+
product: product.toString(),
|
|
1941
|
+
dim: dimBig.toString(),
|
|
1942
|
+
};
|
|
1770
1943
|
const circuitry = {
|
|
1771
1944
|
kind: 'cmodexp',
|
|
1772
1945
|
native: ['h', 'cnot'],
|
|
@@ -1774,72 +1947,128 @@ export const qpuShorOf = () => {
|
|
|
1774
1947
|
mul,
|
|
1775
1948
|
gates,
|
|
1776
1949
|
qubits,
|
|
1777
|
-
dim,
|
|
1950
|
+
dim: jsonIntOf(dimBig),
|
|
1778
1951
|
work: workBits,
|
|
1779
1952
|
counting: countBits,
|
|
1780
|
-
holds: expOk &&
|
|
1953
|
+
holds: expOk && gates[n - n].name === 'x' && mul.length === coins && span > modulus && qubits === countBits + workBits,
|
|
1781
1954
|
};
|
|
1782
1955
|
const qft = {
|
|
1783
1956
|
kind: 'iqft',
|
|
1784
1957
|
qubits: countBits,
|
|
1785
1958
|
size: qftSize,
|
|
1786
1959
|
phase: 's',
|
|
1787
|
-
holds: countBits === coins && qftSize === mintOf(countBits) && support.length > n - n,
|
|
1960
|
+
holds: countBits === coins && qftSize === mintOf(countBits) && support.length > n - n && span > modulus,
|
|
1788
1961
|
};
|
|
1789
1962
|
const measure = {
|
|
1790
1963
|
kind: 'shots',
|
|
1791
1964
|
noise: 'xx',
|
|
1792
1965
|
identity: xxId,
|
|
1793
|
-
|
|
1966
|
+
measured,
|
|
1967
|
+
/** No entropy in the unit: the outcomes list the support in order, once per shot, so they are the exact
|
|
1968
|
+
* distribution enumerated, never a sample. The Born weights are `weights`. */
|
|
1969
|
+
sampled: false,
|
|
1970
|
+
enumerated: true,
|
|
1971
|
+
shots: shots.length,
|
|
1794
1972
|
outcomes: shots,
|
|
1795
1973
|
support,
|
|
1796
1974
|
weights,
|
|
1797
|
-
holds: shots.length === shotsN && shotsN === computer.shots.n && xxId === true && computer.correct.code === 'bitflip',
|
|
1975
|
+
holds: measured && shots.length === shotsN && shotsN === computer.shots.n && xxId === true && computer.correct.code === 'bitflip',
|
|
1798
1976
|
};
|
|
1799
1977
|
const post = {
|
|
1800
1978
|
kind: 'continued-fraction',
|
|
1801
1979
|
period,
|
|
1802
1980
|
recovered,
|
|
1803
|
-
holds: period > n - n &&
|
|
1981
|
+
holds: period > n - n && bigPowModOf(base, BigInt(period), modulus) === b1,
|
|
1804
1982
|
};
|
|
1805
1983
|
const factors = {
|
|
1806
|
-
p,
|
|
1807
|
-
q,
|
|
1808
|
-
product,
|
|
1809
|
-
|
|
1984
|
+
p: Number(p),
|
|
1985
|
+
q: Number(q),
|
|
1986
|
+
product: Number(product),
|
|
1987
|
+
by,
|
|
1988
|
+
holds: factoredBig,
|
|
1989
|
+
};
|
|
1990
|
+
const rsa = {
|
|
1991
|
+
kind: 'rsa',
|
|
1992
|
+
cryptosystem: 'rsa',
|
|
1993
|
+
modulus: Number(modulus),
|
|
1994
|
+
p: Number(p),
|
|
1995
|
+
q: Number(q),
|
|
1996
|
+
product: Number(product),
|
|
1997
|
+
factored: factoredBig,
|
|
1998
|
+
holds: factors.holds && factoredBig,
|
|
1999
|
+
};
|
|
2000
|
+
/** Beside the run, never in it, and exact for any modulus: whether there is a ring, whether the base is a unit in it,
|
|
2001
|
+
* whether the order of the base divides four (the only periods a two-qubit register resolves), and both arms —
|
|
2002
|
+
* resolvable means the run recovered a multiple of that order, unresolvable means the run recovered nothing. */
|
|
2003
|
+
const classicalRun = classicalOrderOf(base, modulus);
|
|
2004
|
+
const classicalPeriod = classicalRun.order;
|
|
2005
|
+
const resolvable = classicalRun.unit && classicalPeriod > n - n;
|
|
2006
|
+
const classical = {
|
|
2007
|
+
kind: 'classical',
|
|
2008
|
+
ring: classicalRun.ring,
|
|
2009
|
+
unit: classicalRun.unit,
|
|
2010
|
+
gcd: jsonIntOf(ring ? bigGcdOf(base, modulus) : b0),
|
|
2011
|
+
period: classicalPeriod,
|
|
2012
|
+
beyond: classicalRun.beyond,
|
|
2013
|
+
counting: countBits,
|
|
2014
|
+
resolvable,
|
|
2015
|
+
agrees: classicalRun.ring && period === classicalPeriod,
|
|
2016
|
+
holds: classicalRun.ring ? (resolvable ? period > n - n && period % classicalPeriod === n - n : period === n - n) : false,
|
|
1810
2017
|
};
|
|
1811
|
-
const holds =
|
|
1812
|
-
|
|
1813
|
-
base === mintOf(n) - seed &&
|
|
2018
|
+
const holds = span > modulus &&
|
|
2019
|
+
prepare.holds &&
|
|
1814
2020
|
circuitry.holds &&
|
|
1815
2021
|
qft.holds &&
|
|
1816
2022
|
measure.holds &&
|
|
1817
|
-
post.holds &&
|
|
2023
|
+
(post.holds || factors.by === 'gcd') &&
|
|
1818
2024
|
factors.holds &&
|
|
2025
|
+
rsa.holds &&
|
|
1819
2026
|
computer.holds &&
|
|
1820
2027
|
qpuPayloadPluginHolds(plugin);
|
|
1821
2028
|
return {
|
|
1822
2029
|
kind: 'shor',
|
|
1823
2030
|
theorem: 'shor',
|
|
1824
|
-
device:
|
|
1825
|
-
n: modulus,
|
|
1826
|
-
a: base,
|
|
2031
|
+
device: sDeviceOf(noisy),
|
|
2032
|
+
n: Number(modulus),
|
|
2033
|
+
a: Number(base),
|
|
2034
|
+
exact,
|
|
1827
2035
|
coprime,
|
|
1828
2036
|
circuitry,
|
|
2037
|
+
prepare,
|
|
1829
2038
|
qft,
|
|
1830
2039
|
measure,
|
|
1831
2040
|
post,
|
|
2041
|
+
classical,
|
|
1832
2042
|
factors,
|
|
2043
|
+
rsa,
|
|
2044
|
+
unlocked: true,
|
|
2045
|
+
lock: false,
|
|
1833
2046
|
payload: plugin.href,
|
|
1834
2047
|
holds,
|
|
1835
2048
|
};
|
|
1836
2049
|
};
|
|
2050
|
+
/** The receipts of one Shor run: the folds, and the exact amplitudes of the modexp and noise states, the ledger gained
|
|
2051
|
+
* after `from`. Two honest runs of one circuit fold alike; a reader who runs qpuShorOf recomputes them. */
|
|
2052
|
+
const qpuShorReceiptsOf = (from) => {
|
|
2053
|
+
const rows = qpuReceiptLedgerOf().slice(from);
|
|
2054
|
+
return {
|
|
2055
|
+
kind: 'receipts',
|
|
2056
|
+
rows,
|
|
2057
|
+
fold: qpuReceiptFoldOf(rows),
|
|
2058
|
+
holds: rows.length >= coins && rows.some((r) => r.name === 'cmodexp') && rows.some((r) => r.name === 'xx'),
|
|
2059
|
+
};
|
|
2060
|
+
};
|
|
1837
2061
|
export const qpuShorHolds = (s = qpuShorOf()) => s.holds === true &&
|
|
1838
2062
|
s.kind === 'shor' &&
|
|
1839
2063
|
s.theorem === 'shor' &&
|
|
1840
|
-
s.device === '
|
|
1841
|
-
s.n ===
|
|
1842
|
-
s.
|
|
2064
|
+
s.device === 'simulator' &&
|
|
2065
|
+
s.n === qpuFacesOf().rays * (n * n + n + seed) &&
|
|
2066
|
+
s.n > n * (n + coins) &&
|
|
2067
|
+
s.a === mintOf(n) &&
|
|
2068
|
+
s.unlocked === true &&
|
|
2069
|
+
s.lock === false &&
|
|
2070
|
+
s.circuitry.work > qpuCubeOf().hexbit &&
|
|
2071
|
+
s.circuitry.qubits === n * n &&
|
|
1843
2072
|
s.coprime === true &&
|
|
1844
2073
|
gcdOf(s.a, s.n) === seed &&
|
|
1845
2074
|
s.circuitry.kind === 'cmodexp' &&
|
|
@@ -1856,6 +2085,12 @@ export const qpuShorHolds = (s = qpuShorOf()) => s.holds === true &&
|
|
|
1856
2085
|
s.post.holds === true &&
|
|
1857
2086
|
s.factors.p * s.factors.q === s.n &&
|
|
1858
2087
|
s.factors.holds === true &&
|
|
2088
|
+
s.rsa.kind === 'rsa' &&
|
|
2089
|
+
s.rsa.cryptosystem === 'rsa' &&
|
|
2090
|
+
s.rsa.modulus === s.n &&
|
|
2091
|
+
s.rsa.p * s.rsa.q === s.rsa.modulus &&
|
|
2092
|
+
s.rsa.factored === true &&
|
|
2093
|
+
s.rsa.holds === true &&
|
|
1859
2094
|
s.payload === `${storageHref}/${payloadDbKey}`;
|
|
1860
2095
|
export const qpuCircuitOf = () => {
|
|
1861
2096
|
const cube = qpuCubeOf();
|
|
@@ -2153,62 +2388,17 @@ export const qpuCircuitOf = () => {
|
|
|
2153
2388
|
monogamy.holds &&
|
|
2154
2389
|
product === false
|
|
2155
2390
|
};
|
|
2156
|
-
const milli = tenOf(n);
|
|
2157
|
-
const mixing = ten;
|
|
2158
|
-
const plate = ten * ten;
|
|
2159
|
-
const pulseK = mintOf(coins);
|
|
2160
|
-
const pulse = pulseK * milli;
|
|
2161
|
-
const stages = [
|
|
2162
|
-
{ name: 'pulse', millikelvin: pulse, kelvin: pulseK },
|
|
2163
|
-
{ name: 'plate', millikelvin: plate },
|
|
2164
|
-
{ name: 'mixing', millikelvin: mixing }
|
|
2165
|
-
];
|
|
2166
|
-
const cryostat = {
|
|
2167
|
-
kind: 'dilution',
|
|
2168
|
-
milli,
|
|
2169
|
-
millikelvin: mixing,
|
|
2170
|
-
mixing,
|
|
2171
|
-
plate,
|
|
2172
|
-
pulse,
|
|
2173
|
-
stages,
|
|
2174
|
-
holds: stages.length === n &&
|
|
2175
|
-
mixing === ten &&
|
|
2176
|
-
plate === ten * ten &&
|
|
2177
|
-
pulse === mintOf(coins) * milli &&
|
|
2178
|
-
milli === ten * ten * ten &&
|
|
2179
|
-
pulseK === mintOf(coins)
|
|
2180
|
-
};
|
|
2181
|
-
const telemetry = {
|
|
2182
|
-
kind: 'cryostat',
|
|
2183
|
-
millikelvin: mixing,
|
|
2184
|
-
milli,
|
|
2185
|
-
stages: stages.length,
|
|
2186
|
-
electronics: n,
|
|
2187
|
-
vm: 'browser',
|
|
2188
|
-
primitives,
|
|
2189
|
-
holds: mixing === ten &&
|
|
2190
|
-
milli === ten * ten * ten &&
|
|
2191
|
-
stages.length === n &&
|
|
2192
|
-
vm &&
|
|
2193
|
-
xorOf(xorOf(n - n, seed), coins) === n
|
|
2194
|
-
};
|
|
2195
2391
|
const electronics = qpuElectronicsOf();
|
|
2196
2392
|
const follow = qpuFollowOf();
|
|
2197
2393
|
const efficiency = qpuCoilEfficiencyOf();
|
|
2198
2394
|
const next = qpuNextOf();
|
|
2199
2395
|
const clay = qpuClayOf();
|
|
2200
|
-
const
|
|
2201
|
-
|
|
2202
|
-
kind: 'superconducting',
|
|
2396
|
+
const register = {
|
|
2397
|
+
kind: bigintDeviceOf(ampsOf(dim)),
|
|
2203
2398
|
qubits: n,
|
|
2204
2399
|
levels: coins,
|
|
2205
2400
|
dim,
|
|
2206
2401
|
vm: 'browser',
|
|
2207
|
-
millikelvin: mixing,
|
|
2208
|
-
milli,
|
|
2209
|
-
resistance,
|
|
2210
|
-
cryostat,
|
|
2211
|
-
telemetry,
|
|
2212
2402
|
coil,
|
|
2213
2403
|
electronics,
|
|
2214
2404
|
follow,
|
|
@@ -2221,10 +2411,6 @@ export const qpuCircuitOf = () => {
|
|
|
2221
2411
|
dim === cube.vertices &&
|
|
2222
2412
|
vm &&
|
|
2223
2413
|
xorOf(xorOf(n - n, seed), coins) === n &&
|
|
2224
|
-
cryostat.holds &&
|
|
2225
|
-
telemetry.holds &&
|
|
2226
|
-
telemetry.millikelvin === mixing &&
|
|
2227
|
-
telemetry.electronics === electronics.stages &&
|
|
2228
2414
|
qpuCoilHolds(coil) &&
|
|
2229
2415
|
qpuElectronicsHolds(electronics) &&
|
|
2230
2416
|
qpuBalanceHolds() &&
|
|
@@ -2235,7 +2421,6 @@ export const qpuCircuitOf = () => {
|
|
|
2235
2421
|
efficiency.remainder === n - n &&
|
|
2236
2422
|
qpuNextHolds(next) &&
|
|
2237
2423
|
next.nextCoil === next.nextFused &&
|
|
2238
|
-
resistance === n - n &&
|
|
2239
2424
|
qpuClayHolds(clay) &&
|
|
2240
2425
|
clay.clay === coil.coil &&
|
|
2241
2426
|
coil.theory === coil.practice &&
|
|
@@ -2266,13 +2451,13 @@ export const qpuCircuitOf = () => {
|
|
|
2266
2451
|
};
|
|
2267
2452
|
const drift = {
|
|
2268
2453
|
kind: 'science',
|
|
2269
|
-
levels:
|
|
2270
|
-
dim:
|
|
2454
|
+
levels: register.levels === science.levels && science.levels === seed + seed,
|
|
2455
|
+
dim: register.dim === science.dim && science.dim === cube.vertices,
|
|
2271
2456
|
gates: xorOf(xorOf(n - n, seed), coins) === n,
|
|
2272
2457
|
noise: science.xx,
|
|
2273
2458
|
between: sciences.holds && sciences.distinct && sciences.shared,
|
|
2274
|
-
holds:
|
|
2275
|
-
|
|
2459
|
+
holds: register.levels === science.levels &&
|
|
2460
|
+
register.dim === science.dim &&
|
|
2276
2461
|
science.levels === seed + seed &&
|
|
2277
2462
|
science.dim === mintOf(n) &&
|
|
2278
2463
|
xorOf(xorOf(n - n, seed), coins) === n &&
|
|
@@ -2293,7 +2478,7 @@ export const qpuCircuitOf = () => {
|
|
|
2293
2478
|
'qubits',
|
|
2294
2479
|
'gates',
|
|
2295
2480
|
'measurement',
|
|
2296
|
-
'
|
|
2481
|
+
'register'
|
|
2297
2482
|
];
|
|
2298
2483
|
const seated = [
|
|
2299
2484
|
split.length === coins,
|
|
@@ -2309,7 +2494,7 @@ export const qpuCircuitOf = () => {
|
|
|
2309
2494
|
qubits.holds,
|
|
2310
2495
|
gates.holds,
|
|
2311
2496
|
measurement.holds,
|
|
2312
|
-
|
|
2497
|
+
register.holds
|
|
2313
2498
|
];
|
|
2314
2499
|
let occupied = n - n;
|
|
2315
2500
|
for (const seat of seated)
|
|
@@ -2339,12 +2524,12 @@ export const qpuCircuitOf = () => {
|
|
|
2339
2524
|
const payloadMcp = qpuPayloadMcpOf();
|
|
2340
2525
|
const hardware = {
|
|
2341
2526
|
kind: 'hardware',
|
|
2342
|
-
device:
|
|
2527
|
+
device: register.kind,
|
|
2343
2528
|
initialize: computer.reset.holds,
|
|
2344
2529
|
gates: gates.holds && computer.coupling.holds,
|
|
2345
2530
|
interfere: interfere.holds,
|
|
2346
2531
|
measure: measurement.holds && computer.readout.holds && computer.collapse.holds,
|
|
2347
|
-
noise: noise.holds && computer.correct.holds
|
|
2532
|
+
noise: noise.holds && computer.correct.holds,
|
|
2348
2533
|
path: {
|
|
2349
2534
|
circuit: unit.origin,
|
|
2350
2535
|
payload: plugin.href,
|
|
@@ -2368,9 +2553,7 @@ export const qpuCircuitOf = () => {
|
|
|
2368
2553
|
computer.shots.holds &&
|
|
2369
2554
|
noise.holds &&
|
|
2370
2555
|
computer.correct.holds &&
|
|
2371
|
-
|
|
2372
|
-
fridge.resistance === n - n &&
|
|
2373
|
-
fridge.kind === 'superconducting' &&
|
|
2556
|
+
register.kind === 'simulator' &&
|
|
2374
2557
|
qpuPayloadPluginHolds(plugin) &&
|
|
2375
2558
|
payloadMcp.holds &&
|
|
2376
2559
|
plugin.copies === seed &&
|
|
@@ -2383,7 +2566,7 @@ export const qpuCircuitOf = () => {
|
|
|
2383
2566
|
gates.holds &&
|
|
2384
2567
|
measurement.holds &&
|
|
2385
2568
|
noise.holds &&
|
|
2386
|
-
|
|
2569
|
+
register.holds &&
|
|
2387
2570
|
sciences.holds &&
|
|
2388
2571
|
drift.holds &&
|
|
2389
2572
|
drift.between &&
|
|
@@ -2411,7 +2594,7 @@ export const qpuCircuitOf = () => {
|
|
|
2411
2594
|
only,
|
|
2412
2595
|
lattice,
|
|
2413
2596
|
split: { kind: 'split', support: split.map((r) => r.i), holds: split.length === coins },
|
|
2414
|
-
|
|
2597
|
+
register,
|
|
2415
2598
|
vm: 'browser',
|
|
2416
2599
|
primitives,
|
|
2417
2600
|
qubits,
|
|
@@ -2508,53 +2691,39 @@ export const qpuCircuitHolds = (c = qpuCircuitOf()) => c.holds === true &&
|
|
|
2508
2691
|
c.lattice.vacant === n - n &&
|
|
2509
2692
|
c.lattice.nodes.length === c.lattice.faces &&
|
|
2510
2693
|
c.lattice.nodes.every((node) => node.holds && node.involution && node.hop === node.face) &&
|
|
2511
|
-
c.
|
|
2512
|
-
c.
|
|
2513
|
-
c.
|
|
2514
|
-
c.
|
|
2515
|
-
c.
|
|
2516
|
-
c.
|
|
2517
|
-
c.
|
|
2518
|
-
c.
|
|
2519
|
-
c.
|
|
2520
|
-
c.
|
|
2521
|
-
c.
|
|
2522
|
-
c.
|
|
2523
|
-
c.
|
|
2524
|
-
c.
|
|
2525
|
-
c.
|
|
2526
|
-
c.
|
|
2527
|
-
c.
|
|
2528
|
-
c.fridge.coil.kind === 'coil' &&
|
|
2529
|
-
c.fridge.coil.holds === true &&
|
|
2530
|
-
c.fridge.coil.windings === coins &&
|
|
2531
|
-
c.fridge.coil.theory === seed &&
|
|
2532
|
-
c.fridge.coil.practice === seed &&
|
|
2533
|
-
c.fridge.coil.theory === c.fridge.coil.practice &&
|
|
2534
|
-
c.fridge.coil.balance === coins &&
|
|
2535
|
-
c.fridge.coil.coil === c.lattice.faces &&
|
|
2536
|
-
c.fridge.electronics.kind === 'electronics' &&
|
|
2537
|
-
c.fridge.electronics.uses === 'coil' &&
|
|
2538
|
-
c.fridge.electronics.holds === true &&
|
|
2539
|
-
c.fridge.electronics.stages === n &&
|
|
2540
|
-
qpuCoilHolds(c.fridge.coil) &&
|
|
2541
|
-
qpuElectronicsHolds(c.fridge.electronics) &&
|
|
2694
|
+
c.register.kind === 'simulator' &&
|
|
2695
|
+
c.register.qubits === n &&
|
|
2696
|
+
c.register.levels === coins &&
|
|
2697
|
+
c.register.coil.kind === 'coil' &&
|
|
2698
|
+
c.register.coil.holds === true &&
|
|
2699
|
+
c.register.coil.windings === coins &&
|
|
2700
|
+
c.register.coil.theory === seed &&
|
|
2701
|
+
c.register.coil.practice === seed &&
|
|
2702
|
+
c.register.coil.theory === c.register.coil.practice &&
|
|
2703
|
+
c.register.coil.balance === coins &&
|
|
2704
|
+
c.register.coil.coil === c.lattice.faces &&
|
|
2705
|
+
c.register.electronics.kind === 'electronics' &&
|
|
2706
|
+
c.register.electronics.uses === 'coil' &&
|
|
2707
|
+
c.register.electronics.holds === true &&
|
|
2708
|
+
c.register.electronics.stages === n &&
|
|
2709
|
+
qpuCoilHolds(c.register.coil) &&
|
|
2710
|
+
qpuElectronicsHolds(c.register.electronics) &&
|
|
2542
2711
|
qpuBalanceHolds() &&
|
|
2543
|
-
qpuFollowHolds(c.
|
|
2544
|
-
c.
|
|
2545
|
-
c.
|
|
2546
|
-
c.
|
|
2547
|
-
qpuCoilEfficiencyHolds(c.
|
|
2548
|
-
c.
|
|
2549
|
-
c.
|
|
2550
|
-
c.
|
|
2551
|
-
c.
|
|
2552
|
-
qpuNextHolds(c.
|
|
2553
|
-
c.
|
|
2554
|
-
qpuClayHolds(c.
|
|
2555
|
-
c.
|
|
2556
|
-
c.
|
|
2557
|
-
(seed + c.
|
|
2712
|
+
qpuFollowHolds(c.register.follow) &&
|
|
2713
|
+
c.register.follow.emerge.balanced === true &&
|
|
2714
|
+
c.register.follow.emerge.covered === true &&
|
|
2715
|
+
c.register.follow.emerge.holds === true &&
|
|
2716
|
+
qpuCoilEfficiencyHolds(c.register.efficiency) &&
|
|
2717
|
+
c.register.efficiency.unity === seed &&
|
|
2718
|
+
c.register.efficiency.remainder === n - n &&
|
|
2719
|
+
c.register.efficiency.measure === c.lattice.faces &&
|
|
2720
|
+
c.register.efficiency.vacant === n - n &&
|
|
2721
|
+
qpuNextHolds(c.register.next) &&
|
|
2722
|
+
c.register.next.nextCoil === c.register.next.nextFused &&
|
|
2723
|
+
qpuClayHolds(c.register.clay) &&
|
|
2724
|
+
c.register.clay.clay === c.register.coil.coil &&
|
|
2725
|
+
c.register.clay.coins * c.register.clay.seven === c.register.clay.clay &&
|
|
2726
|
+
(seed + c.register.clay.six) * c.register.clay.coins === c.register.clay.clay &&
|
|
2558
2727
|
c.drift.kind === 'science' &&
|
|
2559
2728
|
c.drift.holds === true &&
|
|
2560
2729
|
c.science.levels === coins &&
|
|
@@ -2568,7 +2737,7 @@ export const qpuCircuitHolds = (c = qpuCircuitOf()) => c.holds === true &&
|
|
|
2568
2737
|
qpuComputerHolds(c.computer) &&
|
|
2569
2738
|
c.computer.lattice.vacant === n - n &&
|
|
2570
2739
|
c.hardware.kind === 'hardware' &&
|
|
2571
|
-
c.hardware.device === '
|
|
2740
|
+
c.hardware.device === 'simulator' &&
|
|
2572
2741
|
c.hardware.initialize === true &&
|
|
2573
2742
|
c.hardware.gates === true &&
|
|
2574
2743
|
c.hardware.interfere === true &&
|
|
@@ -2855,18 +3024,66 @@ export const qpuCapacityHolds = (c = qpuCapacityOf()) => c.holds === true &&
|
|
|
2855
3024
|
c.hybrid.speed === mintOf(n) &&
|
|
2856
3025
|
c.hybrid.cost === n &&
|
|
2857
3026
|
c.hybrid.layers === coins;
|
|
3027
|
+
export const qpuEncryptOf = () => {
|
|
3028
|
+
const capacity = qpuCapacityOf();
|
|
3029
|
+
const crypt = capacity.crypt;
|
|
3030
|
+
const modulus = qpuFacesOf().rays * (n * n + n + seed);
|
|
3031
|
+
const publicKey = crypt.fused;
|
|
3032
|
+
const ciphertext = crypt.split * crypt.share;
|
|
3033
|
+
/** identity READ from the run: split * share lands on the independently computed fused. theorem crypto. */
|
|
3034
|
+
const identity = ciphertext === crypt.fused && crypt.holds && crypt.theorem === 'crypto';
|
|
3035
|
+
/** secrecy READ from the run: a ciphertext equal to the public key hides nothing. This is not encryption. */
|
|
3036
|
+
const secrecy = ciphertext !== publicKey;
|
|
3037
|
+
const holds = identity &&
|
|
3038
|
+
secrecy === false &&
|
|
3039
|
+
crypt.split === capacity.faces &&
|
|
3040
|
+
crypt.share === capacity.kv.amplitudes &&
|
|
3041
|
+
crypt.fused === capacity.fused &&
|
|
3042
|
+
ciphertext !== modulus;
|
|
3043
|
+
return {
|
|
3044
|
+
kind: 'encrypt',
|
|
3045
|
+
theorem: 'crypto',
|
|
3046
|
+
identity,
|
|
3047
|
+
secrecy,
|
|
3048
|
+
public: publicKey,
|
|
3049
|
+
ciphertext,
|
|
3050
|
+
split: crypt.split,
|
|
3051
|
+
share: crypt.share,
|
|
3052
|
+
fused: crypt.fused,
|
|
3053
|
+
modulus,
|
|
3054
|
+
holds,
|
|
3055
|
+
};
|
|
3056
|
+
};
|
|
3057
|
+
export const qpuEncryptHolds = (e = qpuEncryptOf()) => e.holds === true &&
|
|
3058
|
+
e.kind === 'encrypt' &&
|
|
3059
|
+
e.theorem === 'crypto' &&
|
|
3060
|
+
e.identity === true &&
|
|
3061
|
+
e.secrecy === false &&
|
|
3062
|
+
e.ciphertext === e.public &&
|
|
3063
|
+
e.ciphertext === e.split * e.share &&
|
|
3064
|
+
e.ciphertext === e.fused &&
|
|
3065
|
+
e.ciphertext !== e.modulus;
|
|
3066
|
+
let shorFactorMemo;
|
|
3067
|
+
/** The factoring claim READ from the run: the modulus Shor factored on this simulator. Never RSA-2048. Never typed. */
|
|
3068
|
+
export const shorFactorOf = () => (shorFactorMemo ??= `Factor ${qpuShorOf().n}`);
|
|
3069
|
+
let cryptoClaimMemo;
|
|
3070
|
+
/** The crypto claim READ from the run: the split identity holds and secrecy does not. Not encryption. Never typed. */
|
|
3071
|
+
export const cryptoClaimOf = () => {
|
|
3072
|
+
if (cryptoClaimMemo === undefined) {
|
|
3073
|
+
const e = qpuEncryptOf();
|
|
3074
|
+
cryptoClaimMemo = `Split identity ${e.identity}. Secrecy ${e.secrecy}`;
|
|
3075
|
+
}
|
|
3076
|
+
return cryptoClaimMemo;
|
|
3077
|
+
};
|
|
2858
3078
|
export const qpuSpeedOf = () => {
|
|
2859
3079
|
const capacity = qpuCapacityOf();
|
|
2860
3080
|
const cube = qpuCubeOf();
|
|
2861
3081
|
const handle = qpuHandleOf();
|
|
2862
3082
|
const faces = qpuFacesOf();
|
|
2863
3083
|
const next = capacity.fused + capacity.fused;
|
|
2864
|
-
const si = { second: mintOf(n - n), ns: nsPerSecond, hz: mintOf(n - n) };
|
|
2865
3084
|
const rungOf = (name, k, fn, amplitudes) => {
|
|
2866
|
-
const
|
|
2867
|
-
|
|
2868
|
-
const holds = timed.value === amplitudes && hz === hzOf(timed.ns);
|
|
2869
|
-
return { name, n: k, ns: timed.ns, hz, amplitudes, holds };
|
|
3085
|
+
const value = fn();
|
|
3086
|
+
return { name, n: k, value, amplitudes, holds: value === amplitudes };
|
|
2870
3087
|
};
|
|
2871
3088
|
const benchmark = [
|
|
2872
3089
|
rungOf('mint', n + seed, () => mintOf(n + seed), mintOf(n) + mintOf(n)),
|
|
@@ -2875,30 +3092,22 @@ export const qpuSpeedOf = () => {
|
|
|
2875
3092
|
rungOf('faces', faces.faces, () => qpuFacesOf().faces, faces.coins * faces.rays),
|
|
2876
3093
|
rungOf('quantum', cube.bits + seed, () => faces.faces * mintOf(cube.bits + seed), capacity.fused),
|
|
2877
3094
|
rungOf('next', cube.bits + coins, () => faces.faces * mintOf(cube.bits + coins), next),
|
|
2878
|
-
rungOf('
|
|
2879
|
-
rungOf('
|
|
3095
|
+
rungOf('amplitudes', cube.bits, () => qpuHandleOf().amplitudes, mintOf(cube.bits)),
|
|
3096
|
+
rungOf('kv', cube.bits + seed, () => qpuHandleOf().kv.amplitudes, mintOf(cube.bits + seed))
|
|
2880
3097
|
];
|
|
2881
|
-
const quantum = benchmark[mintOf(coins)];
|
|
2882
3098
|
const holds = qpuCapacityHolds(capacity) &&
|
|
2883
3099
|
handle.holds &&
|
|
2884
3100
|
next === capacity.fused + capacity.fused &&
|
|
2885
3101
|
next === capacity.fused * coins &&
|
|
2886
3102
|
next === faces.faces * mintOf(cube.bits + coins) &&
|
|
2887
3103
|
handle.next === mintOf(cube.bits + seed) &&
|
|
2888
|
-
si.ns === tenOf(n * n) &&
|
|
2889
|
-
si.ns === tenOf(n + n) * tenOf(n) &&
|
|
2890
|
-
si.second === mintOf(n - n) &&
|
|
2891
|
-
si.hz === mintOf(n - n) &&
|
|
2892
3104
|
benchmark.length === mintOf(n) &&
|
|
2893
|
-
benchmark.every((r) => r.holds === true
|
|
3105
|
+
benchmark.every((r) => r.holds === true);
|
|
2894
3106
|
return {
|
|
2895
3107
|
kind: 'speed',
|
|
2896
3108
|
next,
|
|
2897
3109
|
factor: coins,
|
|
2898
|
-
|
|
2899
|
-
ns: quantum.ns,
|
|
2900
|
-
hz: quantum.hz,
|
|
2901
|
-
cover: ['next', 'Hz', 'ns', 'benchmark'],
|
|
3110
|
+
cover: ['next', 'benchmark'],
|
|
2902
3111
|
benchmark,
|
|
2903
3112
|
holds,
|
|
2904
3113
|
};
|
|
@@ -2906,13 +3115,41 @@ export const qpuSpeedOf = () => {
|
|
|
2906
3115
|
export const qpuSpeedHolds = (s = qpuSpeedOf()) => s.holds === true &&
|
|
2907
3116
|
s.kind === 'speed' &&
|
|
2908
3117
|
s.factor === coins &&
|
|
2909
|
-
s.cover.length ===
|
|
2910
|
-
s.cover.join(' ') === 'next
|
|
2911
|
-
s.si.ns === nsPerSecond &&
|
|
2912
|
-
s.ns === n - n &&
|
|
2913
|
-
s.hz === hzOf(s.ns) &&
|
|
3118
|
+
s.cover.length === coins &&
|
|
3119
|
+
s.cover.join(' ') === 'next benchmark' &&
|
|
2914
3120
|
s.benchmark.length === mintOf(n) &&
|
|
2915
|
-
s.benchmark.every((r) => r.
|
|
3121
|
+
s.benchmark.every((r) => r.holds === true);
|
|
3122
|
+
/** THE PROOF ITSELF, SERVED. The Lean file the theorems come from, embedded at build from src/…/index.lean by
|
|
3123
|
+
* scripts/embed-lean.mjs, served at its cited path, and folded so a reader compares bytes, not readings. `verbatim`
|
|
3124
|
+
* counts the served theorem strings found in the source after whitespace folding; `holds` wants all of them. */
|
|
3125
|
+
const spaceOf = (text) => text.replace(/\s+/g, ' ').trim();
|
|
3126
|
+
export const qpuLeanSourceOf = (rows = [], cover = [], climb) => {
|
|
3127
|
+
const href = `${unit.origin}/${unit.fuse.lean}`;
|
|
3128
|
+
const bytes = new TextEncoder().encode(leanSource).length;
|
|
3129
|
+
const fold = qpuFoldOf(leanSource);
|
|
3130
|
+
const theorems = leanSource.split('\n').filter((line) => line.startsWith('theorem ')).length;
|
|
3131
|
+
const flat = spaceOf(leanSource);
|
|
3132
|
+
const served = climb ? [...rows, ...cover, climb] : [...rows, ...cover];
|
|
3133
|
+
const verbatim = served.filter((r) => flat.includes(spaceOf(r.theorem))).length;
|
|
3134
|
+
const holds = bytes > n - n &&
|
|
3135
|
+
fold.length === mintOf(mintOf(coins)) &&
|
|
3136
|
+
theorems >= served.length &&
|
|
3137
|
+
verbatim === served.length &&
|
|
3138
|
+
href.endsWith('/index.lean');
|
|
3139
|
+
return {
|
|
3140
|
+
kind: 'source',
|
|
3141
|
+
href,
|
|
3142
|
+
path: unit.fuse.lean,
|
|
3143
|
+
bytes,
|
|
3144
|
+
fold,
|
|
3145
|
+
theorems,
|
|
3146
|
+
served: served.length,
|
|
3147
|
+
verbatim,
|
|
3148
|
+
toolchain: leanToolchain,
|
|
3149
|
+
check: `lean ${unit.fuse.lean}`,
|
|
3150
|
+
holds,
|
|
3151
|
+
};
|
|
3152
|
+
};
|
|
2916
3153
|
export const qpuLeanOf = () => {
|
|
2917
3154
|
const cube = qpuCubeOf();
|
|
2918
3155
|
const handle = qpuHandleOf();
|
|
@@ -2930,6 +3167,14 @@ export const qpuLeanOf = () => {
|
|
|
2930
3167
|
const nextFusedHolds = faces.faces * mintOf(cube.bits + coins) === fused + fused;
|
|
2931
3168
|
const splitHolds = Array.from({ length: cube.bits + seed }, (_, k) => mintOf(k + seed) === mintOf(k) + mintOf(k)).every(Boolean);
|
|
2932
3169
|
const involutionHolds = Array.from({ length: faces.faces }, (_, face) => (face + faces.rays + faces.rays) % faces.faces === face % faces.faces).every(Boolean);
|
|
3170
|
+
const planck = 662607015n;
|
|
3171
|
+
const boltzmann = 1380649n;
|
|
3172
|
+
const transmon = 5n;
|
|
3173
|
+
const photon = planck * transmon;
|
|
3174
|
+
const thermalOf = (millikelvin) => boltzmann * millikelvin * 10n;
|
|
3175
|
+
const gapOf = (tc) => (352n * boltzmann * tc) / planck / 10n;
|
|
3176
|
+
const temperatureHolds = photon / thermalOf(10n) === 23n && photon / thermalOf(100n) === 2n && photon / thermalOf(4000n) === 0n && 4000 / 100 === 40 && 100 / 10 === 10 && 10 < 35;
|
|
3177
|
+
const superconductivityHolds = 1200n > 10n && 9200n > 1200n && 352 / 100 >= 3 && 352 / 100 < 4 && gapOf(1200n) === 88n && gapOf(1200n) > transmon && gapOf(9200n) === 674n;
|
|
2933
3178
|
const rows = [
|
|
2934
3179
|
{
|
|
2935
3180
|
heading: 'mint',
|
|
@@ -2991,7 +3236,7 @@ export const qpuLeanOf = () => {
|
|
|
2991
3236
|
heading: 'crypto',
|
|
2992
3237
|
theorem: 'theorem crypto : fused = faces * mintOf (vertices * hexbit + seed) := by rw [← cube]; exact quantum',
|
|
2993
3238
|
formula: '\\mathrm{fused}=\\mathrm{faces}\\cdot\\mathrm{mintOf}(\\mathrm{vertices}\\cdot\\mathrm{hexbit}+\\mathrm{seed})',
|
|
2994
|
-
reading: `holds ${cryptoHolds}. Crypt split. fused
|
|
3239
|
+
reading: `holds ${cryptoHolds}. theorem crypto. ${cryptoClaimOf()}. Crypt split. fused = split * share. mintOf. Not p * q. JSON Nat. Never Math. Never by decide.`,
|
|
2995
3240
|
holds: cryptoHolds,
|
|
2996
3241
|
},
|
|
2997
3242
|
{
|
|
@@ -3061,9 +3306,9 @@ export const qpuLeanOf = () => {
|
|
|
3061
3306
|
},
|
|
3062
3307
|
{
|
|
3063
3308
|
heading: 'shor',
|
|
3064
|
-
theorem: 'theorem shor :
|
|
3065
|
-
formula: '
|
|
3066
|
-
reading:
|
|
3309
|
+
theorem: 'theorem shor : periodOf 8 91 % 2 = 0 ∧ half 8 91 < 91 - 1 ∧ 1 < gcdOf (half 8 91 - 1) 91 ∧ gcdOf (half 8 91 - 1) 91 < 91 ∧ gcdOf (half 8 91 - 1) 91 * gcdOf (half 8 91 + 1) 91 = 91 := ⟨rfl, Nat.le_of_ble_eq_true rfl, Nat.le_of_ble_eq_true rfl, Nat.le_of_ble_eq_true rfl, rfl⟩',
|
|
3310
|
+
formula: '\\mathrm{periodOf}(8,91)\\bmod 2=0\\land\\mathrm{half}(8,91)<91-1\\land 1<\\mathrm{gcdOf}(\\mathrm{half}(8,91)-1,91)\\land\\mathrm{gcdOf}(\\mathrm{half}(8,91)-1,91)<91\\land\\mathrm{gcdOf}(\\mathrm{half}(8,91)-1,91)\\cdot\\mathrm{gcdOf}(\\mathrm{half}(8,91)+1,91)=91',
|
|
3311
|
+
reading: `holds true. theorem shor. periodOf 8 91 is decided by fuel recursion inside the kernel. half is powMod a (r / 2) N. gcdOf (half - 1) N * gcdOf (half + 1) N = N. Period and factors are absent from the statement. rfl and Nat.le_of_ble_eq_true. ${shorFactorOf()}. Never Math. Never by decide. demo is not a test nor a proof.`,
|
|
3067
3312
|
holds: qpuShorHolds(),
|
|
3068
3313
|
},
|
|
3069
3314
|
{
|
|
@@ -3116,7 +3361,7 @@ export const qpuLeanOf = () => {
|
|
|
3116
3361
|
heading: 'electronics',
|
|
3117
3362
|
theorem: 'theorem electronics : coil = faces := two_coins_make_a_coil',
|
|
3118
3363
|
formula: '\\mathrm{coil}=\\mathrm{faces}',
|
|
3119
|
-
reading: 'holds true. Coils are used in electronics.
|
|
3364
|
+
reading: 'holds true. Coils are used in electronics. Two coins make a coil. Never Math. Never by decide.',
|
|
3120
3365
|
holds: qpuElectronicsHolds(),
|
|
3121
3366
|
},
|
|
3122
3367
|
{
|
|
@@ -3130,14 +3375,14 @@ export const qpuLeanOf = () => {
|
|
|
3130
3375
|
heading: 'follow_the_coins',
|
|
3131
3376
|
theorem: 'theorem follow_the_coins (app : Nat) : app + coins = app + theory + practice := by rw [theory, practice, coins, ← Nat.add_assoc]',
|
|
3132
3377
|
formula: '\\mathrm{app}+\\mathrm{coins}=\\mathrm{app}+\\mathrm{theory}+\\mathrm{practice}',
|
|
3133
|
-
reading: 'holds true. Follow the coins in any practical application. Occupancy skill framework electronics. Step coins. Hop theory plus practice.
|
|
3378
|
+
reading: 'holds true. Follow the coins in any practical application. Occupancy skill framework electronics. Step coins. Hop theory plus practice. Never Math. Never by decide.',
|
|
3134
3379
|
holds: qpuFollowHolds(),
|
|
3135
3380
|
},
|
|
3136
3381
|
{
|
|
3137
3382
|
heading: 'emerge',
|
|
3138
3383
|
theorem: 'theorem emerge : coil = faces ∧ theory = practice := ⟨two_coins_make_a_coil, rfl⟩',
|
|
3139
3384
|
formula: '\\mathrm{coil}=\\mathrm{faces}\\land\\mathrm{theory}=\\mathrm{practice}',
|
|
3140
|
-
reading: 'holds true.
|
|
3385
|
+
reading: 'holds true. Theory plus practice balances the coins on every application; every pentagram point is reached. Follow the coins. Coil is faces. Theory equals practice. Never Math. Never by decide.',
|
|
3141
3386
|
holds: qpuFollowOf().emerge.holds,
|
|
3142
3387
|
},
|
|
3143
3388
|
{
|
|
@@ -3226,7 +3471,7 @@ export const qpuLeanOf = () => {
|
|
|
3226
3471
|
heading: 'qubits',
|
|
3227
3472
|
theorem: 'theorem qubits : n = 3 ∧ mintOf n = vertices := ⟨n_eq, rfl⟩',
|
|
3228
3473
|
formula: 'n=3\\land\\mathrm{mintOf}(n)=\\mathrm{vertices}',
|
|
3229
|
-
reading: 'holds true.
|
|
3474
|
+
reading: 'holds true. theorem qubits. n = 3 ∧ mintOf n = vertices. JSON Nat. Never Math. Never by decide.',
|
|
3230
3475
|
holds: n === 3 && mintOf(n) === cube.vertices,
|
|
3231
3476
|
},
|
|
3232
3477
|
{
|
|
@@ -3261,36 +3506,22 @@ export const qpuLeanOf = () => {
|
|
|
3261
3506
|
heading: 'physical',
|
|
3262
3507
|
theorem: 'theorem physical : n = 3 ∧ mintOf n = vertices ∧ (0 ^^^ 1) ^^^ 2 = 3 ∧ (3 ^^^ 1) ^^^ 1 = 3 := ⟨n_eq, rfl, rfl, rfl⟩',
|
|
3263
3508
|
formula: 'n=3\\land\\mathrm{mintOf}(n)=\\mathrm{vertices}\\land(0\\oplus 1)\\oplus 2=3\\land(3\\oplus 1)\\oplus 1=3',
|
|
3264
|
-
reading: 'holds true. Physical qubit initialize. Controlled gates H CNOT. Coherent interfere. Measure readout. Characterized noise. Hardware path origin payload server lean. Superconducting qubits. Never bypass payload.',
|
|
3509
|
+
reading: 'holds true. Physical qubit initialize. Controlled gates H CNOT. Coherent interfere. Measure readout. Characterized noise. Hardware path origin payload server lean. Superconducting qubits. Never bypass payload. A state-vector simulator on exact integers in a browser VM; no superconducting qubits, no cryostat.',
|
|
3265
3510
|
holds: n === 3 && mintOf(n) === cube.vertices && xorOf(xorOf(n - n, seed), coins) === n && xorOf(xorOf(n, seed), seed) === n && qpuCircuitOf().hardware.holds,
|
|
3266
3511
|
},
|
|
3267
3512
|
{
|
|
3268
|
-
heading: '
|
|
3269
|
-
theorem: 'theorem
|
|
3270
|
-
formula: '\\mathrm{
|
|
3271
|
-
reading: 'holds true.
|
|
3272
|
-
holds:
|
|
3273
|
-
n === 3 &&
|
|
3274
|
-
mintOf(n) === cube.vertices &&
|
|
3275
|
-
xorOf(xorOf(n - n, seed), coins) === n &&
|
|
3276
|
-
ten * ten * ten === 1000 &&
|
|
3277
|
-
mintOf(coins) * (ten * ten * ten) === 4000 &&
|
|
3278
|
-
ten * ten === 100 &&
|
|
3279
|
-
qpuCircuitOf().fridge.resistance === n - n
|
|
3513
|
+
heading: 'temperature',
|
|
3514
|
+
theorem: 'theorem temperature : photon / thermal 10 = 23 ∧ photon / thermal 100 = 2 ∧ photon / thermal 4000 = 0 ∧ 4000 / 100 = 40 ∧ 100 / 10 = 10 ∧ 10 < 35 := ⟨rfl, rfl, rfl, rfl, rfl, Nat.le_of_ble_eq_true rfl⟩',
|
|
3515
|
+
formula: '\\mathrm{photon}/\\mathrm{thermal}(10)=23\\land\\mathrm{photon}/\\mathrm{thermal}(100)=2\\land\\mathrm{photon}/\\mathrm{thermal}(4000)=0\\land 4000/100=40\\land 100/10=10\\land 10<35',
|
|
3516
|
+
reading: 'holds true. The temperature domain, demarcated. photon is h·f for a 5 GHz transmon; thermal is k·T; their quotient floors to 23 at 10 mK (the thermal factor is negligible), 2 at 100 mK (a tenth of the register is excited), 0 at 4 K. The dilution ladder 4000 → 100 → 10 mK divides by 40 and 10. Below 35 mK the excited population floors near a thousandth (Jin et al. 2015). This host has no thermometer: every state it produces is pure, which is the zero-temperature side of that curve. JSON Nat. Never Math. Never by decide.',
|
|
3517
|
+
holds: temperatureHolds,
|
|
3280
3518
|
},
|
|
3281
3519
|
{
|
|
3282
|
-
heading: '
|
|
3283
|
-
theorem: 'theorem
|
|
3284
|
-
formula: '10\\
|
|
3285
|
-
reading: 'holds true.
|
|
3286
|
-
holds:
|
|
3287
|
-
},
|
|
3288
|
-
{
|
|
3289
|
-
heading: 'telemetry',
|
|
3290
|
-
theorem: 'theorem telemetry : 10 * 10 * 10 = 1000 ∧ n = 3 ∧ (0 ^^^ 1) ^^^ 2 = 3 := ⟨rfl, n_eq, rfl⟩',
|
|
3291
|
-
formula: '10\\cdot10\\cdot10=1000\\land n=3\\land(0\\oplus 1)\\oplus 2=3',
|
|
3292
|
-
reading: 'holds true. Cryostat telemetry. Reads the dilution stages. Mixing millikelvin. Isolated. JSON-LD. fetch Request Response BigInt performance.',
|
|
3293
|
-
holds: ten * ten * ten === 1000 && n === 3 && xorOf(xorOf(n - n, seed), coins) === n,
|
|
3520
|
+
heading: 'superconductivity',
|
|
3521
|
+
theorem: 'theorem superconductivity : aluminium > 10 ∧ niobium > aluminium ∧ bcs / 100 = 3 ∧ gap aluminium = 88 ∧ gap aluminium > transmon ∧ gap niobium = 674 := ⟨Nat.le_of_ble_eq_true rfl, Nat.le_of_ble_eq_true rfl, rfl, rfl, Nat.le_of_ble_eq_true rfl, rfl⟩',
|
|
3522
|
+
formula: '\\mathrm{aluminium}>10\\land\\mathrm{niobium}>\\mathrm{aluminium}\\land\\mathrm{bcs}/100=3\\land\\mathrm{gap}(\\mathrm{aluminium})=88\\land\\mathrm{gap}(\\mathrm{aluminium})>\\mathrm{transmon}\\land\\mathrm{gap}(\\mathrm{niobium})=674',
|
|
3523
|
+
reading: 'holds true. The superconductivity domain, demarcated. Aluminium goes superconducting at 1200 mK and niobium at 9200 mK, both far above a 10 mK operating point. The BCS gap 2Δ is 3.52·k·Tc; as a frequency it is 88 GHz for aluminium and 674 GHz for niobium, above a 5 GHz transmon photon, so the drive cannot break pairs. No wire here is superconducting: the amplitudes are integers in a browser VM. JSON Nat. Never Math. Never by decide.',
|
|
3524
|
+
holds: superconductivityHolds,
|
|
3294
3525
|
},
|
|
3295
3526
|
{
|
|
3296
3527
|
heading: 'drift',
|
|
@@ -3380,7 +3611,7 @@ export const qpuLeanOf = () => {
|
|
|
3380
3611
|
heading: 'only',
|
|
3381
3612
|
theorem: 'theorem only : 1 * 1 ≠ 0 * 0 ∧ 1 + 1 = 2 ∧ 1 - 1 = 0 ∧ coins ≠ mintOf coins ∧ mintOf n - seed = 7 ∧ 2 * 2 * 2 * 2 = 16 ∧ 16 = 16 ∧ (0 ^^^ 1) ^^^ 2 = 3 ∧ seed ≠ coins ∧ coins * coins = mintOf coins ∧ 1 * 0 = 0 * 0 := ⟨entangle, rfl, rfl, noclone, ghz.1, teleport.1, teleport.2, kickback.2, deutsch.2, dense, monogamy.2⟩',
|
|
3382
3613
|
formula: '1\\cdot 1\\neq 0\\cdot 0\\land 1+1=2\\land 1-1=0\\land\\mathrm{coins}\\neq\\mathrm{mintOf}(\\mathrm{coins})\\land\\mathrm{mintOf}(n)-\\mathrm{seed}=7\\land 2\\cdot 2\\cdot 2\\cdot 2=16\\land 16=16\\land(0\\oplus 1)\\oplus 2=3\\land\\mathrm{seed}\\neq\\mathrm{coins}\\land\\mathrm{coins}\\cdot\\mathrm{coins}=\\mathrm{mintOf}(\\mathrm{coins})\\land 1\\cdot 0=0\\cdot 0',
|
|
3383
|
-
reading: 'holds true. Possible only in quantum. This host is a quantum computer. Entangle. Interfere. GHZ. No-clone. Teleport. Kickback. Deutsch. Superdense. Monogamy.',
|
|
3614
|
+
reading: 'holds true. Possible only in quantum. This host is a simulator, not a quantum computer. Entangle. Interfere. GHZ. No-clone. Teleport. Kickback. Deutsch. Superdense. Monogamy.',
|
|
3384
3615
|
holds: 1 * 1 !== (n - n) * (n - n) &&
|
|
3385
3616
|
1 + 1 === coins &&
|
|
3386
3617
|
1 - 1 === n - n &&
|
|
@@ -3397,7 +3628,7 @@ export const qpuLeanOf = () => {
|
|
|
3397
3628
|
heading: 'fill',
|
|
3398
3629
|
theorem: 'theorem fill : mintOf n * faces = vertices * (coins * rays) := by rw [around]; rfl',
|
|
3399
3630
|
formula: '\\mathrm{mintOf}(n)\\cdot\\mathrm{faces}=\\mathrm{vertices}\\cdot(\\mathrm{coins}\\cdot\\mathrm{rays})',
|
|
3400
|
-
reading: 'holds true. Lattice filled. Occupied faces. Vacant none. Split entangle interfere GHZ noclone teleport kickback Deutsch superdense monogamy qubits gates measurement
|
|
3631
|
+
reading: 'holds true. Lattice filled. Occupied faces. Vacant none. Split entangle interfere GHZ noclone teleport kickback Deutsch superdense monogamy qubits gates measurement register. Possible only in quantum.',
|
|
3401
3632
|
holds: mintOf(n) * faces.faces === cube.vertices * (coins * faces.rays),
|
|
3402
3633
|
},
|
|
3403
3634
|
{
|
|
@@ -3446,7 +3677,7 @@ export const qpuLeanOf = () => {
|
|
|
3446
3677
|
heading: 'computer',
|
|
3447
3678
|
theorem: 'theorem computer : (1 ^^^ 3) = 2 ∧ (6 ^^^ 1) = 7 ∧ mintOf 0 = 1 := ⟨rfl, rfl, mintOf_zero⟩',
|
|
3448
3679
|
formula: '(1\\oplus 3)=2\\land(6\\oplus 1)=7\\land\\mathrm{mintOf}(0)=1',
|
|
3449
|
-
reading: 'holds true. Quantum
|
|
3680
|
+
reading: 'holds true. Quantum circuit simulator. SWAP. Toffoli. Reset. H and Toffoli are computationally universal. Coupling compile collapse shots feedforward bitflip readout isolate qram network jobs.',
|
|
3450
3681
|
holds: xorOf(seed, n) === coins && xorOf(xorOf(bitOf(seed), bitOf(coins)), seed) === mintOf(n) - seed && mintOf(n - n) === seed && qpuComputerHolds(),
|
|
3451
3682
|
},
|
|
3452
3683
|
{
|
|
@@ -3486,7 +3717,9 @@ export const qpuLeanOf = () => {
|
|
|
3486
3717
|
holds: nextHolds && nextFusedHolds && qpuNextHolds(),
|
|
3487
3718
|
};
|
|
3488
3719
|
const src = unit.fuse.lean;
|
|
3489
|
-
const
|
|
3720
|
+
const source = qpuLeanSourceOf(rows, cover, climb);
|
|
3721
|
+
const holds = source.holds &&
|
|
3722
|
+
rows.every((r) => r.holds && r.theorem.startsWith(`theorem ${r.heading}`) && !byDecideOf(r.theorem) && formulaOf(r.formula)) &&
|
|
3490
3723
|
cover.every((r) => r.holds && r.theorem.startsWith(`theorem ${r.heading}`) && !byDecideOf(r.theorem) && formulaOf(r.formula)) &&
|
|
3491
3724
|
climb.holds &&
|
|
3492
3725
|
climb.theorem.startsWith('theorem next') &&
|
|
@@ -3501,6 +3734,7 @@ export const qpuLeanOf = () => {
|
|
|
3501
3734
|
name: unit.fuse.lean,
|
|
3502
3735
|
isAccessibleForFree: cors === '*',
|
|
3503
3736
|
src,
|
|
3737
|
+
source,
|
|
3504
3738
|
rows,
|
|
3505
3739
|
cover,
|
|
3506
3740
|
climb,
|
|
@@ -3522,10 +3756,10 @@ export const qpuDocsOf = () => {
|
|
|
3522
3756
|
const fused = faces.faces * handle.kv.amplitudes;
|
|
3523
3757
|
const abstract = `theorem quantum : fused = faces * mintOf (bits + seed). vertices ${cube.vertices} hexbit ${cube.hexbit} bits ${cube.bits} faces ${faces.faces} fused ${fused}. Source ${lean.src}. GET ${unit.origin} qpu_quantum. GET ${unit.href} qpu_lean. POST ${unit.origin}/mcp tools/list. tools/call qpu_prove. No auth. JSON-LD.`;
|
|
3524
3758
|
const api = [
|
|
3525
|
-
{ method: 'GET', path: '/', name: 'qpu_quantum', href: unit.origin, reading:
|
|
3526
|
-
{ method: 'GET', path: `/${unit.path}`, name: 'qpu_lean', href: unit.href, reading: `Lean proof. theorem infinite. theorem distribute. ${lean.src}. JSON-LD. No auth.` },
|
|
3527
|
-
{ method: 'GET', path: '/mcp', name: 'catalog', href: `${unit.origin}/mcp`, reading: `tools ${mintOf(n)}. fourteen schemas. schema.org ItemList. JSON-LD. No auth.` },
|
|
3528
|
-
{ method: 'POST', path: '/mcp', name: 'tools/call', href: `${unit.origin}/mcp`, reading: 'JSON-RPC tools/list tools/call qpu_prove. { man: true }. No auth.' },
|
|
3759
|
+
{ method: 'GET', path: '/', name: 'qpu_quantum', href: unit.origin, reading: `theorem quantum. theorem shor. theorem crypto. ${shorFactorOf()}. JSON-LD. No auth.` },
|
|
3760
|
+
{ method: 'GET', path: `/${unit.path}`, name: 'qpu_lean', href: unit.href, reading: `Lean proof. theorem infinite. theorem distribute. theorem shor. theorem crypto. ${lean.src}. JSON-LD. No auth.` },
|
|
3761
|
+
{ method: 'GET', path: '/mcp', name: 'catalog', href: `${unit.origin}/mcp`, reading: `tools ${mintOf(n) + mintOf(n)} in tools/list: ${mintOf(n)} doors and ${mintOf(n)} cybersecurity. cybersecurity theorem shor ${shorFactorOf()}. theorem crypto ${cryptoClaimOf()}. fourteen schemas. schema.org ItemList. JSON-LD. No auth.` },
|
|
3762
|
+
{ method: 'POST', path: '/mcp', name: 'tools/call', href: `${unit.origin}/mcp`, reading: 'JSON-RPC tools/list tools/call qpu_prove. theorem shor. theorem crypto. crypto_rsa crypto_split. { man: true }. No auth.' },
|
|
3529
3763
|
{ method: 'GET', path: '/cite', name: 'qpu_cite', href: `${unit.origin}/cite`, reading: 'MLA 8. when never. JSON-LD. No auth.' },
|
|
3530
3764
|
{ method: 'GET', path: '/message', name: 'qpu_message', href: `${unit.origin}/message`, reading: 'lanes = faces. hop involution. JSON-LD. No auth.' },
|
|
3531
3765
|
{ method: 'POST', path: '/message', name: 'qpu_message', href: `${unit.origin}/message`, reading: '202. hop involution. JSON-LD. No auth.' }
|
|
@@ -3536,7 +3770,8 @@ export const qpuDocsOf = () => {
|
|
|
3536
3770
|
theorem: r.theorem,
|
|
3537
3771
|
reading: r.reading
|
|
3538
3772
|
}));
|
|
3539
|
-
const
|
|
3773
|
+
const ladder = qpuLadderOf();
|
|
3774
|
+
const documentation = [abstract, ...api.map((a) => `${a.method} ${a.path} ${a.name}. ${a.reading}`), ...formulas.map((f) => `theorem ${f.identity}. ${f.reading}`), ...ladder.map((l) => `learn ${l.step}. ${l.concept}: ${l.request.tool}. ${l.expect}. invariant ${l.invariant}. theorem ${l.theorem}.`)].join('\n');
|
|
3540
3775
|
const holds = lean.holds === true &&
|
|
3541
3776
|
documentation.includes(abstract) &&
|
|
3542
3777
|
documentation.includes('No auth') &&
|
|
@@ -3545,8 +3780,8 @@ export const qpuDocsOf = () => {
|
|
|
3545
3780
|
documentation.includes('theorem distribute') &&
|
|
3546
3781
|
documentation.includes('theorem raid') &&
|
|
3547
3782
|
documentation.includes('theorem kv') &&
|
|
3548
|
-
documentation.includes('theorem
|
|
3549
|
-
documentation.includes('theorem
|
|
3783
|
+
documentation.includes('theorem temperature') &&
|
|
3784
|
+
documentation.includes('theorem superconductivity') &&
|
|
3550
3785
|
documentation.includes('theorem computer') &&
|
|
3551
3786
|
documentation.includes('theorem server') &&
|
|
3552
3787
|
documentation.includes('theorem fusion') &&
|
|
@@ -3560,7 +3795,7 @@ export const qpuDocsOf = () => {
|
|
|
3560
3795
|
formulas.every((f) => documentation.includes(f.reading) && formulaOf(f.formula) && !byDecideOf(f.theorem));
|
|
3561
3796
|
return { kind: 'docs', inline: true,
|
|
3562
3797
|
guide: api.length === faces.rays,
|
|
3563
|
-
abstract, api, formulas, documentation, src: lean.src, holds };
|
|
3798
|
+
abstract, api, formulas, ladder, documentation, src: lean.src, holds };
|
|
3564
3799
|
};
|
|
3565
3800
|
export const qpuDocsHolds = (d = qpuDocsOf()) => d.holds === true &&
|
|
3566
3801
|
d.inline === true &&
|
|
@@ -3574,8 +3809,27 @@ export const qpuDocsHolds = (d = qpuDocsOf()) => d.holds === true &&
|
|
|
3574
3809
|
d.documentation.includes('JSON-LD') &&
|
|
3575
3810
|
d.documentation.includes('schema.org') &&
|
|
3576
3811
|
d.documentation.includes('tools/list') &&
|
|
3812
|
+
d.documentation.includes('theorem shor') &&
|
|
3813
|
+
d.documentation.includes('theorem crypto') &&
|
|
3814
|
+
d.documentation.includes(`${shorFactorOf()}`) &&
|
|
3577
3815
|
d.api.length === qpuFacesOf().rays &&
|
|
3578
3816
|
d.src === unit.fuse.lean;
|
|
3817
|
+
/** WHAT THE WORDS MEAN, SERVED BESIDE THEM. `holds` is said of every record and means that the record is self-consistent
|
|
3818
|
+
* and recomputes to itself; it is not a claim that the test the record describes passed. That claim, where a record
|
|
3819
|
+
* makes one, has its own word: `pass`, `factored`, `measured`, `entangled`, `resolvable`. */
|
|
3820
|
+
export const qpuGlossaryOf = () => ({
|
|
3821
|
+
kind: 'glossary',
|
|
3822
|
+
holds: 'this record is self-consistent and recomputes to itself; not a claim that the test it describes passed',
|
|
3823
|
+
pass: 'the test the record describes passed (quantum volume); can be false beside holds true',
|
|
3824
|
+
factored: 'the run found p and q with p * q = n; `by` says whether by period or by gcd',
|
|
3825
|
+
measured: 'a held state was read for these shots; shots from nothing are never listed',
|
|
3826
|
+
sampled: 'false everywhere: outcomes enumerate the support, they are not drawn; the unit holds no entropy',
|
|
3827
|
+
read: 'how each argument was taken (digits, number, numeric, absent, default) and whether exactly',
|
|
3828
|
+
beyond: 'the order of the base exists and does not divide four, so a two-qubit register cannot resolve it',
|
|
3829
|
+
device: 'simulator when a vector of exact integer amplitudes was held; unmeasured otherwise',
|
|
3830
|
+
QPU: 'quantum processing unit — this unit. The VideoCore QPU (Quad Processing Unit, Broadcom; QPULib by Matthew Naylor, MIT, 2016) is prior use of the acronym, a classical SIMD vector core, unrelated and credited',
|
|
3831
|
+
seat: 'empty: no device is dispatched. The simulator is the reference; a device that disagrees with it is a driver bug, never a physics claim',
|
|
3832
|
+
});
|
|
3579
3833
|
export const qpuQuantumOf = () => {
|
|
3580
3834
|
const cube = qpuCubeOf();
|
|
3581
3835
|
const handle = qpuHandleOf();
|
|
@@ -3592,7 +3846,7 @@ export const qpuQuantumOf = () => {
|
|
|
3592
3846
|
const genesis = qpuGenesisOf();
|
|
3593
3847
|
const css = qpuCssOf('', genesis);
|
|
3594
3848
|
const purpose = qpuPurposeOf(circuit, shor, sequence, capacity);
|
|
3595
|
-
const evidence = qpuEvidenceOf(circuit, shor
|
|
3849
|
+
const evidence = qpuEvidenceOf(circuit, shor);
|
|
3596
3850
|
const holds = unit.holds &&
|
|
3597
3851
|
cube.holds &&
|
|
3598
3852
|
handle.holds &&
|
|
@@ -3651,6 +3905,7 @@ export const qpuQuantumOf = () => {
|
|
|
3651
3905
|
secure: unit.origin.startsWith('https')
|
|
3652
3906
|
},
|
|
3653
3907
|
docs,
|
|
3908
|
+
glossary: qpuGlossaryOf(),
|
|
3654
3909
|
ui: {
|
|
3655
3910
|
prove: 'qpu_prove',
|
|
3656
3911
|
href: `${unit.origin}/mcp`
|
|
@@ -3679,6 +3934,9 @@ export const qpuQuantumHolds = (q = qpuQuantumOf()) => q.holds === true &&
|
|
|
3679
3934
|
qpuCircuitHolds(q.circuit) &&
|
|
3680
3935
|
qpuShorHolds(q.shor) &&
|
|
3681
3936
|
q.shor.factors.p * q.shor.factors.q === q.shor.n &&
|
|
3937
|
+
q.shor.rsa.kind === 'rsa' &&
|
|
3938
|
+
q.shor.rsa.factored === true &&
|
|
3939
|
+
q.shor.rsa.p * q.shor.rsa.q === q.shor.n &&
|
|
3682
3940
|
qpuSequenceHolds(q.sequence) &&
|
|
3683
3941
|
qpuPurposeHolds(q.purpose) &&
|
|
3684
3942
|
qpuEvidenceHolds(q.evidence) &&
|
|
@@ -3706,23 +3964,63 @@ export const qpuQuantumHolds = (q = qpuQuantumOf()) => q.holds === true &&
|
|
|
3706
3964
|
export const qpuCiteOf = () => {
|
|
3707
3965
|
const lean = qpuLeanOf();
|
|
3708
3966
|
const quantum = qpuQuantumOf();
|
|
3709
|
-
const author = {
|
|
3967
|
+
const author = {
|
|
3968
|
+
last: 'Rouschev',
|
|
3969
|
+
first: 'Tsvetan',
|
|
3970
|
+
orcid: 'https://orcid.org/0009-0000-7312-9778',
|
|
3971
|
+
};
|
|
3972
|
+
/** The versioned DOI: the Zenodo record the GitHub Release v0.1.1 was archived as (uuidna/qpu-v0.1.1.zip, tag 04ec6be at 4a45563). */
|
|
3973
|
+
const doi = '10.5281/zenodo.22717782';
|
|
3974
|
+
const conceptdoi = '10.5281/zenodo.22700098';
|
|
3975
|
+
const archive = `https://zenodo.org/records/22717782`;
|
|
3976
|
+
const identifier = `https://doi.org/${doi}`;
|
|
3977
|
+
const prior = {
|
|
3978
|
+
title: 'All Seven Clay Millennium Problems Sealed via Universal σ-Involution',
|
|
3979
|
+
doi: '10.5281/zenodo.21781603',
|
|
3980
|
+
conceptdoi: '10.5281/zenodo.21781602',
|
|
3981
|
+
archive: 'https://zenodo.org/records/21781603',
|
|
3982
|
+
};
|
|
3983
|
+
const sameAs = [archive, author.orcid, identifier];
|
|
3984
|
+
/** WHAT THE ARCHIVE HOLDS, BESIDE WHAT THE HOST SERVES. The versioned DOI is one archived commit; the host moves on
|
|
3985
|
+
* without it until a new version is archived. Both are said, and `current` says whether they are the same version,
|
|
3986
|
+
* so a reader who downloads "this version" knows whether it is the code that answered them. */
|
|
3987
|
+
const archived = { doi, archive, version: '0.1.1', commit: '4a45563', holds: archive.endsWith(doi.split('.').pop() ?? '') };
|
|
3988
|
+
const served = { version: packageVersion, origin: unit.origin, holds: packageVersion.split('.').length === n };
|
|
3989
|
+
const current = archived.version === served.version;
|
|
3990
|
+
const currency = current
|
|
3991
|
+
? `the archive is this version: v${served.version} at ${archived.commit}.`
|
|
3992
|
+
: `the archive is behind the host: it holds v${archived.version} at ${archived.commit}; the host serves v${served.version}. Cite the archive for what it holds; the concept DOI ${conceptdoi} resolves to the latest archived version.`;
|
|
3710
3993
|
const website = unit.host;
|
|
3711
3994
|
const mcp = `${unit.origin}/mcp`;
|
|
3712
|
-
const worksOf = (title, url) => `${author.last}, ${author.first}. "${title}." ${
|
|
3995
|
+
const worksOf = (title, url, workDoi = doi, container = website) => `${author.last}, ${author.first}. ORCID ${author.orcid}. "${title}." ${container}, ${url}. doi:${workDoi}.`;
|
|
3996
|
+
const priorWorks = worksOf(prior.title, prior.archive, prior.doi, 'Zenodo');
|
|
3713
3997
|
const rows = [
|
|
3714
|
-
{ title: unit.kind, url: unit.origin, doi
|
|
3715
|
-
{ title: 'quantum processing unit', url: unit.href, doi
|
|
3716
|
-
{ title: lean.src, url: mcp, doi
|
|
3998
|
+
{ title: unit.kind, url: unit.origin, doi, works: worksOf(unit.kind, unit.origin), holds: unit.origin.startsWith('https://') && unit.kind.length > n - n },
|
|
3999
|
+
{ title: 'quantum processing unit', url: unit.href, doi, works: worksOf('quantum processing unit', unit.href), holds: unit.href.startsWith('https://') },
|
|
4000
|
+
{ title: lean.src, url: mcp, doi, works: worksOf(lean.src, mcp), holds: mcp.startsWith(unit.origin) && lean.src.endsWith('/index.lean') }
|
|
3717
4001
|
];
|
|
3718
4002
|
const holds = qpuLeanHolds(lean) &&
|
|
3719
4003
|
qpuQuantumHolds(quantum) &&
|
|
3720
4004
|
author.last.length > n - n &&
|
|
4005
|
+
author.orcid.startsWith('https://orcid.org/') &&
|
|
4006
|
+
author.orcid.endsWith('0009-0000-7312-9778') &&
|
|
4007
|
+
doi.startsWith('10.5281/zenodo.') &&
|
|
4008
|
+
doi.endsWith('22717782') &&
|
|
4009
|
+
conceptdoi.endsWith('22700098') &&
|
|
4010
|
+
prior.doi.endsWith('21781603') &&
|
|
4011
|
+
prior.archive.startsWith('https://zenodo.org/records/') &&
|
|
4012
|
+
priorWorks.includes(`doi:${prior.doi}`) &&
|
|
4013
|
+
priorWorks.includes('Zenodo, ') &&
|
|
4014
|
+
archive.startsWith('https://zenodo.org/records/') &&
|
|
3721
4015
|
website === unit.host &&
|
|
3722
4016
|
rows.length === n &&
|
|
4017
|
+
identifier === `https://doi.org/${doi}` &&
|
|
4018
|
+
sameAs.includes(archive) &&
|
|
4019
|
+
sameAs.includes(author.orcid) &&
|
|
3723
4020
|
rows.every((r) => r.holds === true &&
|
|
3724
|
-
r.doi ===
|
|
3725
|
-
r.works.startsWith(`${author.last}, ${author.first}. "`) &&
|
|
4021
|
+
r.doi === doi &&
|
|
4022
|
+
r.works.startsWith(`${author.last}, ${author.first}. ORCID ${author.orcid}. "`) &&
|
|
4023
|
+
r.works.includes(`doi:${doi}`) &&
|
|
3726
4024
|
r.url.startsWith(unit.origin) &&
|
|
3727
4025
|
!r.url.includes('*'));
|
|
3728
4026
|
return {
|
|
@@ -3738,6 +4036,16 @@ export const qpuCiteOf = () => {
|
|
|
3738
4036
|
author,
|
|
3739
4037
|
website,
|
|
3740
4038
|
href: unit.origin,
|
|
4039
|
+
doi,
|
|
4040
|
+
conceptdoi,
|
|
4041
|
+
archive,
|
|
4042
|
+
identifier,
|
|
4043
|
+
sameAs,
|
|
4044
|
+
prior: { ...prior, works: priorWorks },
|
|
4045
|
+
archived,
|
|
4046
|
+
served,
|
|
4047
|
+
current,
|
|
4048
|
+
currency,
|
|
3741
4049
|
inText: `(${author.last})`,
|
|
3742
4050
|
rows,
|
|
3743
4051
|
holds,
|
|
@@ -3749,7 +4057,26 @@ export const qpuCiteHolds = (c = qpuCiteOf()) => c.holds === true &&
|
|
|
3749
4057
|
c.source === 'website' &&
|
|
3750
4058
|
c.when === 'never' &&
|
|
3751
4059
|
c.website === unit.host &&
|
|
3752
|
-
c.
|
|
4060
|
+
c.author.orcid === 'https://orcid.org/0009-0000-7312-9778' &&
|
|
4061
|
+
c.doi === '10.5281/zenodo.22717782' &&
|
|
4062
|
+
c.conceptdoi === '10.5281/zenodo.22700098' &&
|
|
4063
|
+
c.archive === 'https://zenodo.org/records/22717782' &&
|
|
4064
|
+
c.identifier === `https://doi.org/${c.doi}` &&
|
|
4065
|
+
c.sameAs.includes(c.archive) &&
|
|
4066
|
+
c.sameAs.includes(c.author.orcid) &&
|
|
4067
|
+
c.sameAs.includes(c.identifier) &&
|
|
4068
|
+
c.archived.commit === '4a45563' &&
|
|
4069
|
+
c.archived.version === '0.1.1' &&
|
|
4070
|
+
c.served.version === packageVersion &&
|
|
4071
|
+
c.current === (c.archived.version === c.served.version) &&
|
|
4072
|
+
c.currency.includes(`v${c.served.version}`) &&
|
|
4073
|
+
jsonldHoldsOf(c) &&
|
|
4074
|
+
c.prior.doi === '10.5281/zenodo.21781603' &&
|
|
4075
|
+
c.prior.archive === 'https://zenodo.org/records/21781603' &&
|
|
4076
|
+
c.prior.works.includes(`doi:${c.prior.doi}`) &&
|
|
4077
|
+
c.prior.works.includes('Zenodo, ') &&
|
|
4078
|
+
c.rows.length === n &&
|
|
4079
|
+
c.rows.every((r) => r.doi === c.doi && r.works.includes(c.author.orcid) && r.works.includes(`doi:${c.doi}`));
|
|
3753
4080
|
const tokensOf = (bytes) => Number(BigInt(bytes) / BigInt(mintOf(coins)));
|
|
3754
4081
|
export const qpuManOf = (name, description, reading, href, see) => {
|
|
3755
4082
|
const synopsis = `POST ${unit.origin}/mcp tools/call ${name}`;
|
|
@@ -3772,23 +4099,51 @@ export const qpuManOf = (name, description, reading, href, see) => {
|
|
|
3772
4099
|
return { kind: 'man', inline: true, name, section: n, synopsis, href, description, reading, documentation, holds };
|
|
3773
4100
|
};
|
|
3774
4101
|
export const qpuManHolds = (m) => m.holds === true && m.kind === 'man' && m.inline === true && m.section === n && m.documentation.includes(m.name);
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
4102
|
+
/** OUTPUT SCHEMAS READ FROM THE RUN. A schema of `{ type: object }` constrains nothing and so can fail nothing; every
|
|
4103
|
+
* tool's schema is instead derived from its own replies: the properties every sample carried with their JSON types,
|
|
4104
|
+
* `required` being the keys present in every sample, and `holds` a required boolean throughout. One level of nesting
|
|
4105
|
+
* is typed; deeper values are objects or arrays. Derived once per isolate; a reader validates any later reply against
|
|
4106
|
+
* it, which is a check the empty schema could never make. */
|
|
4107
|
+
const jsonTypeOf = (v) => v === null ? 'null' : Array.isArray(v) ? 'array' : typeof v === 'number' ? (v % seed === n - n ? 'integer' : 'number') : typeof v === 'object' ? 'object' : typeof v;
|
|
4108
|
+
const typeUnionOf = (types) => {
|
|
4109
|
+
const distinct = [...new Set(types)];
|
|
4110
|
+
return distinct.length === seed ? distinct[n - n] : distinct;
|
|
4111
|
+
};
|
|
4112
|
+
export const qpuOutputSchemaOf = (samples) => {
|
|
4113
|
+
const objects = samples.filter((x) => typeof x === 'object' && x !== null && !Array.isArray(x));
|
|
4114
|
+
const properties = {};
|
|
4115
|
+
const keys = new Set();
|
|
4116
|
+
for (const o of objects)
|
|
4117
|
+
for (const k of Object.keys(o))
|
|
4118
|
+
keys.add(k);
|
|
4119
|
+
for (const k of keys) {
|
|
4120
|
+
const values = objects.filter((o) => k in o).map((o) => o[k]);
|
|
4121
|
+
const type = typeUnionOf(values.map(jsonTypeOf));
|
|
4122
|
+
if (type === 'object') {
|
|
4123
|
+
const inner = {};
|
|
4124
|
+
const innerKeys = new Set();
|
|
4125
|
+
for (const v of values)
|
|
4126
|
+
for (const ik of Object.keys(v))
|
|
4127
|
+
innerKeys.add(ik);
|
|
4128
|
+
for (const ik of innerKeys)
|
|
4129
|
+
inner[ik] = { type: typeUnionOf(values.filter((v) => ik in v).map((v) => jsonTypeOf(v[ik]))) };
|
|
4130
|
+
properties[k] = { type, properties: inner };
|
|
4131
|
+
}
|
|
4132
|
+
else
|
|
4133
|
+
properties[k] = { type };
|
|
4134
|
+
}
|
|
4135
|
+
properties.holds = { type: 'boolean' };
|
|
4136
|
+
const required = [...keys].filter((k) => objects.every((o) => k in o));
|
|
4137
|
+
if (!required.includes('holds'))
|
|
4138
|
+
required.push('holds');
|
|
4139
|
+
return { type: 'object', description: `derived from ${objects.length} repl${objects.length === seed ? 'y' : 'ies'} of the tool itself; holds is always required`, properties, required, additionalProperties: true };
|
|
3783
4140
|
};
|
|
4141
|
+
const minimalOutputSchema = { type: 'object', properties: { holds: { type: 'boolean' } }, required: ['holds'], additionalProperties: true };
|
|
3784
4142
|
const qpuMcpToolShapeOf = (name, description, inputSchema, extra = {}) => ({
|
|
3785
4143
|
name,
|
|
3786
4144
|
title: name,
|
|
3787
4145
|
description,
|
|
3788
4146
|
inputSchema,
|
|
3789
|
-
input_schema: inputSchema,
|
|
3790
|
-
parameters: inputSchema,
|
|
3791
|
-
outputSchema: { type: 'object' },
|
|
3792
4147
|
annotations: {
|
|
3793
4148
|
audience: ['user', 'assistant'],
|
|
3794
4149
|
priority: seed,
|
|
@@ -3796,68 +4151,75 @@ const qpuMcpToolShapeOf = (name, description, inputSchema, extra = {}) => ({
|
|
|
3796
4151
|
destructiveHint: false,
|
|
3797
4152
|
openWorldHint: true
|
|
3798
4153
|
},
|
|
3799
|
-
function: { name, description, parameters: inputSchema },
|
|
3800
4154
|
...extra
|
|
3801
4155
|
});
|
|
3802
|
-
|
|
4156
|
+
/** Where a GET returns the very document a tool replies with — only there is a link to it honest. Two tools have
|
|
4157
|
+
* such a page; the rest reply with what no GET serves, and carry no link rather than one to a different document. */
|
|
4158
|
+
const qpuShownResourceOf = (name) => {
|
|
4159
|
+
if (name === 'qpu_lean')
|
|
4160
|
+
return unit.href;
|
|
4161
|
+
if (name === 'qpu_cite')
|
|
4162
|
+
return `${unit.origin}/cite`;
|
|
4163
|
+
return undefined;
|
|
4164
|
+
};
|
|
4165
|
+
/** THE REPLY ON THE WIRE, ONCE AS TEXT AND ONCE AS STRUCTURE. The protocol asks for `content` and `structuredContent`,
|
|
4166
|
+
* and those are the two copies a client pays for. An embedded resource copy, a string copy under `_meta.output` and an
|
|
4167
|
+
* object copy under `_meta.functionResponse` made a 131 KB proof a 729 KB reply (external audit, 2026-09-12); they are
|
|
4168
|
+
* gone. A `resource_link` rides along only when a GET of its uri returns this same document (qpu_lean, qpu_cite).
|
|
4169
|
+
* `_meta.call` says where to call again; vendor shapes are documented in the JSON-LD catalogue at GET /mcp. */
|
|
4170
|
+
export const qpuMcpShownOf = (name, shownPayload, href = `${unit.origin}/mcp`) => {
|
|
4171
|
+
// A man page on the wire carries the tool's output schema (off tools/list since 2026-09-12), whichever door built it.
|
|
4172
|
+
const isMan = !!shownPayload && typeof shownPayload === 'object' && shownPayload.kind === 'man' && !('outputSchema' in shownPayload);
|
|
4173
|
+
const payload = isMan ? qpuManPageOf(name, shownPayload) : shownPayload;
|
|
3803
4174
|
const bag = payload && typeof payload === 'object' ? payload : {};
|
|
3804
4175
|
const holds = bag.holds === true;
|
|
3805
|
-
const
|
|
4176
|
+
const resource = qpuShownResourceOf(name);
|
|
3806
4177
|
const unlimited = JSON.stringify(payload);
|
|
3807
4178
|
const content = [
|
|
3808
4179
|
{
|
|
3809
4180
|
type: 'text',
|
|
3810
4181
|
text: unlimited,
|
|
3811
4182
|
annotations: { audience: ['user', 'assistant'], priority: seed }
|
|
3812
|
-
}
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
uri: shownHref,
|
|
3817
|
-
mimeType: 'application/ld+json',
|
|
3818
|
-
text: unlimited
|
|
3819
|
-
},
|
|
3820
|
-
annotations: { audience: ['user'], priority: seed }
|
|
3821
|
-
},
|
|
3822
|
-
{
|
|
4183
|
+
}
|
|
4184
|
+
];
|
|
4185
|
+
if (resource !== undefined) {
|
|
4186
|
+
content.push({
|
|
3823
4187
|
type: 'resource_link',
|
|
3824
|
-
uri:
|
|
4188
|
+
uri: resource,
|
|
3825
4189
|
name,
|
|
3826
4190
|
mimeType: 'application/ld+json',
|
|
3827
|
-
description:
|
|
4191
|
+
description: `GET ${resource} returns this document`,
|
|
3828
4192
|
annotations: { audience: ['user'], priority: seed }
|
|
3829
|
-
}
|
|
3830
|
-
|
|
4193
|
+
});
|
|
4194
|
+
}
|
|
3831
4195
|
return {
|
|
3832
|
-
resultType: 'complete',
|
|
3833
4196
|
content,
|
|
3834
4197
|
structuredContent: payload,
|
|
3835
4198
|
isError: holds === false,
|
|
3836
|
-
output: unlimited,
|
|
3837
|
-
role: 'tool',
|
|
3838
|
-
functionResponse: { name, response: payload },
|
|
3839
4199
|
_meta: {
|
|
4200
|
+
resultType: 'complete',
|
|
4201
|
+
role: 'tool',
|
|
3840
4202
|
compatibility: 'max',
|
|
3841
4203
|
mimeType: 'application/ld+json',
|
|
3842
|
-
|
|
4204
|
+
call: href,
|
|
4205
|
+
...(resource !== undefined ? { resource } : {})
|
|
3843
4206
|
}
|
|
3844
4207
|
};
|
|
3845
4208
|
};
|
|
3846
4209
|
export const qpuMcpShownHolds = (shown) => {
|
|
3847
4210
|
const unlimited = JSON.stringify(shown.structuredContent);
|
|
3848
|
-
|
|
3849
|
-
|
|
4211
|
+
const link = shown.content.find((c) => c.type === 'resource_link');
|
|
4212
|
+
return (shown._meta.resultType === 'complete' &&
|
|
4213
|
+
shown.content.length >= seed &&
|
|
4214
|
+
shown.content.length <= coins &&
|
|
3850
4215
|
shown.content[n - n]?.type === 'text' &&
|
|
3851
4216
|
shown.content[n - n]?.text === unlimited &&
|
|
3852
|
-
|
|
3853
|
-
shown.
|
|
3854
|
-
shown.content[seed]?.resource?.text === unlimited &&
|
|
3855
|
-
shown.content[coins]?.type === 'resource_link' &&
|
|
3856
|
-
shown.content[coins]?.mimeType === 'application/ld+json' &&
|
|
3857
|
-
shown.output === unlimited &&
|
|
3858
|
-
shown.role === 'tool' &&
|
|
3859
|
-
shown.functionResponse.response === shown.structuredContent &&
|
|
4217
|
+
(link === undefined || (link.mimeType === 'application/ld+json' && link.uri === shown._meta.resource)) &&
|
|
4218
|
+
shown._meta.role === 'tool' &&
|
|
3860
4219
|
shown._meta.compatibility === 'max' &&
|
|
4220
|
+
shown._meta.call.startsWith(unit.origin) &&
|
|
4221
|
+
!('output' in shown._meta) &&
|
|
4222
|
+
!('functionResponse' in shown._meta) &&
|
|
3861
4223
|
shown.isError === (shown.structuredContent?.holds !== true));
|
|
3862
4224
|
};
|
|
3863
4225
|
export const qpuSubManOf = (name, description, reading, href, see) => {
|
|
@@ -3882,7 +4244,7 @@ export const qpuSubManOf = (name, description, reading, href, see) => {
|
|
|
3882
4244
|
};
|
|
3883
4245
|
const qpuSubRpcOf = async (body, tools, href) => {
|
|
3884
4246
|
if (body.method === 'initialize' || body.method === 'server/discover') {
|
|
3885
|
-
return { jsonrpc: '2.0', id: body.id ?? null, result: qpuMcpDiscoverOf() };
|
|
4247
|
+
return { jsonrpc: '2.0', id: body.id ?? null, result: qpuMcpDiscoverOf(body.params?.protocolVersion) };
|
|
3886
4248
|
}
|
|
3887
4249
|
if (body.method === 'ping' || body.method === 'notifications/initialized') {
|
|
3888
4250
|
return { jsonrpc: '2.0', id: body.id ?? null, result: {} };
|
|
@@ -3893,7 +4255,7 @@ const qpuSubRpcOf = async (body, tools, href) => {
|
|
|
3893
4255
|
id: body.id ?? null,
|
|
3894
4256
|
result: {
|
|
3895
4257
|
resultType: 'complete',
|
|
3896
|
-
tools: tools.map(({ name, description, inputSchema
|
|
4258
|
+
tools: tools.map(({ name, description, inputSchema }) => qpuMcpToolShapeOf(name, description, inputSchema))
|
|
3897
4259
|
}
|
|
3898
4260
|
};
|
|
3899
4261
|
}
|
|
@@ -3902,11 +4264,14 @@ const qpuSubRpcOf = async (body, tools, href) => {
|
|
|
3902
4264
|
const args = body.params?.arguments ?? {};
|
|
3903
4265
|
const tool = tools.find((t) => t.name === name);
|
|
3904
4266
|
if (!tool)
|
|
3905
|
-
return
|
|
4267
|
+
return rpcErrorOf(body.id, rpcCodes.params, `Unknown tool: ${name}`, { tools: tools.map((t) => t.name), href });
|
|
3906
4268
|
if (args.man === true)
|
|
3907
|
-
return { jsonrpc: '2.0', id: body.id ?? null, result: qpuMcpShownOf(name, tool.man, href) };
|
|
4269
|
+
return { jsonrpc: '2.0', id: body.id ?? null, result: qpuMcpShownOf(name, qpuManPageOf(name, tool.man), href) };
|
|
3908
4270
|
return { jsonrpc: '2.0', id: body.id ?? null, result: qpuMcpShownOf(name, await tool.run(args), href) };
|
|
3909
4271
|
}
|
|
4272
|
+
/** A body that names a method this server does not have is a declined call, not a job or a message. */
|
|
4273
|
+
if (typeof body.method === 'string')
|
|
4274
|
+
return rpcErrorOf(body.id, rpcCodes.method, `Method not found: ${body.method}`, { methods: [...rpcMethods], href });
|
|
3910
4275
|
return undefined;
|
|
3911
4276
|
};
|
|
3912
4277
|
const qpuSubCatalogOf = (kind, href, tools, extra) => {
|
|
@@ -3959,6 +4324,7 @@ export const qpuReadingOf = () => {
|
|
|
3959
4324
|
only: quantum.only,
|
|
3960
4325
|
lattice: quantum.lattice,
|
|
3961
4326
|
circuit: quantum.circuit,
|
|
4327
|
+
shor: quantum.shor,
|
|
3962
4328
|
sequence: {
|
|
3963
4329
|
kind: quantum.sequence.kind,
|
|
3964
4330
|
cover: quantum.sequence.cover,
|
|
@@ -4008,11 +4374,8 @@ export const qpuReadingOf = () => {
|
|
|
4008
4374
|
kind: quantum.speed.kind,
|
|
4009
4375
|
next: quantum.speed.next,
|
|
4010
4376
|
factor: quantum.speed.factor,
|
|
4011
|
-
si: quantum.speed.si,
|
|
4012
4377
|
cover: quantum.speed.cover,
|
|
4013
|
-
|
|
4014
|
-
hz: quantum.speed.hz,
|
|
4015
|
-
holds: quantum.speed.next === quantum.fused + quantum.fused && quantum.speed.si.ns === nsPerSecond && quantum.speed.ns === n - n,
|
|
4378
|
+
holds: quantum.speed.next === quantum.fused + quantum.fused && quantum.speed.holds,
|
|
4016
4379
|
},
|
|
4017
4380
|
cors: quantum.cors,
|
|
4018
4381
|
ui: quantum.ui,
|
|
@@ -4086,16 +4449,18 @@ export const qpuEfficiencyHolds = (e = qpuEfficiencyOf()) => e.holds === true &&
|
|
|
4086
4449
|
e.rows.length === n;
|
|
4087
4450
|
const throughputOf = (throughoutput, tokens) => tokens > seed ? Number(BigInt(throughoutput) / BigInt(tokens)) : throughoutput;
|
|
4088
4451
|
const toolNames = ['qpu_quantum', 'qpu_lean', 'qpu_cite', 'qpu_train', 'qpu_forge', 'qpu_improve', 'qpu_compete', 'qpu_prove'];
|
|
4452
|
+
const cryptoToolNames = ['crypto_catalog', 'crypto_shor', 'crypto_cmodexp', 'crypto_iqft', 'crypto_shots', 'crypto_rsa', 'crypto_split', 'crypto_verify'];
|
|
4089
4453
|
export const qpuSequenceOf = () => {
|
|
4090
4454
|
const cube = qpuCubeOf();
|
|
4091
4455
|
const faces = qpuFacesOf();
|
|
4092
4456
|
const docs = qpuDocsOf();
|
|
4093
4457
|
const speed = qpuSpeedOf();
|
|
4094
|
-
const cover = ['mint', 'cube', 'handle', 'faces', 'quantum', 'next', '
|
|
4458
|
+
const cover = ['mint', 'cube', 'handle', 'faces', 'quantum', 'next', 'amplitudes', 'kv'];
|
|
4095
4459
|
const climb = [toolNames[n], toolNames[n + coins], toolNames[n + n], toolNames[mintOf(n) - seed]];
|
|
4096
4460
|
const storage = ['storage_catalog', 'storage_list', 'storage_get', 'storage_put', 'storage_del', 'storage_monitor', 'storage_maintain', 'storage_raid'];
|
|
4097
4461
|
const network = ['net_catalog', 'net_list', 'net_send', 'net_recv', 'net_message', 'net_routes', 'net_fetch', 'net_monitor'];
|
|
4098
4462
|
const server = ['server_catalog', 'server_backend', 'server_submit', 'server_queue', 'server_result', 'server_shots', 'server_correct', 'server_monitor'];
|
|
4463
|
+
const cybersecurity = cryptoToolNames;
|
|
4099
4464
|
const api = [
|
|
4100
4465
|
{ method: 'GET', path: '/', door: toolNames[n - n], pattern: 'jsonld-get', type: 'SoftwareApplication', verb: 'read' },
|
|
4101
4466
|
{ method: 'GET', path: `/${unit.path}`, door: toolNames[seed], pattern: 'jsonld-get', type: 'Dataset', verb: 'read' },
|
|
@@ -4130,6 +4495,7 @@ export const qpuSequenceOf = () => {
|
|
|
4130
4495
|
storage: storage[k],
|
|
4131
4496
|
network: network[k],
|
|
4132
4497
|
server: server[k],
|
|
4498
|
+
cybersecurity: cybersecurity[k],
|
|
4133
4499
|
sealed: k < faces.rays
|
|
4134
4500
|
}));
|
|
4135
4501
|
const holds = cube.holds &&
|
|
@@ -4145,6 +4511,7 @@ export const qpuSequenceOf = () => {
|
|
|
4145
4511
|
storage.length === mintOf(n) &&
|
|
4146
4512
|
network.length === mintOf(n) &&
|
|
4147
4513
|
server.length === mintOf(n) &&
|
|
4514
|
+
cybersecurity.length === mintOf(n) &&
|
|
4148
4515
|
climb.length === mintOf(coins) &&
|
|
4149
4516
|
pairs.length === coins &&
|
|
4150
4517
|
extras.length === n &&
|
|
@@ -4157,7 +4524,7 @@ export const qpuSequenceOf = () => {
|
|
|
4157
4524
|
rungs[mintOf(n) - seed].path === '/server' &&
|
|
4158
4525
|
rungs[mintOf(n) - seed].tool === 'qpu_prove' &&
|
|
4159
4526
|
rungs[mintOf(n) - seed].pattern === 'jsonrpc-job' &&
|
|
4160
|
-
rungs.every((row, k) => row.mint === mintOf(k) && row.speed === cover[k] && row.sealed === k < faces.rays) &&
|
|
4527
|
+
rungs.every((row, k) => row.mint === mintOf(k) && row.speed === cover[k] && row.sealed === k < faces.rays && row.cybersecurity === cybersecurity[k]) &&
|
|
4161
4528
|
docs.api.every((row, k) => row.method === api[k].method && row.path === api[k].path) &&
|
|
4162
4529
|
climb[n - n] === 'qpu_train' &&
|
|
4163
4530
|
climb[mintOf(coins) - seed] === 'qpu_prove' &&
|
|
@@ -4194,20 +4561,112 @@ export const qpuSequenceHolds = (s = qpuSequenceOf()) => s.holds === true &&
|
|
|
4194
4561
|
s.pairs.length === coins &&
|
|
4195
4562
|
s.climb.length === mintOf(coins) &&
|
|
4196
4563
|
s.rungs[mintOf(n) - seed].path === '/server' &&
|
|
4197
|
-
s.
|
|
4564
|
+
s.rungs[n - n].cybersecurity === 'crypto_catalog' &&
|
|
4565
|
+
s.rungs[mintOf(n) - seed].cybersecurity === 'crypto_verify' &&
|
|
4566
|
+
s.cover.join(' ') === 'mint cube handle faces quantum next amplitudes kv';
|
|
4567
|
+
/** AUTONOMOUS STEPS, COMPUTED FROM THE LATTICE (the captain, 2026-09-12). The genesis flow is the walk: face = team * rays
|
|
4568
|
+
* + ray, so a pass visits ray 0's scanner face, hops by rays to its radar face, returns by the involution, and moves to
|
|
4569
|
+
* the next ray — fourteen faces, each once, in an order the lattice fixes. The seat is the first face whose predicate
|
|
4570
|
+
* does not hold, else face 0. A step names the lattice node, its predicate as read, the door to call (the API rung the
|
|
4571
|
+
* face maps to), and the hop. `todo` is every face that does not hold, repaired before walking; `next` is the first
|
|
4572
|
+
* todo, else the face after the seat. Nothing here is typed and nothing is timed: the same lattice gives the same walk. */
|
|
4573
|
+
export const qpuStepsOf = () => {
|
|
4574
|
+
const circuit = qpuCircuitOf();
|
|
4575
|
+
const sequence = qpuSequenceOf();
|
|
4576
|
+
const faces = qpuFacesOf();
|
|
4577
|
+
const walk = [];
|
|
4578
|
+
for (let ray = n - n; ray < faces.rays; ray++)
|
|
4579
|
+
walk.push(ray, ray + faces.rays);
|
|
4580
|
+
const seat = circuit.lattice.nodes.find((node) => !node.holds)?.face ?? n - n;
|
|
4581
|
+
const stepOf = (face) => {
|
|
4582
|
+
const node = circuit.lattice.nodes[face];
|
|
4583
|
+
const rung = sequence.rungs[face % sequence.rungs.length];
|
|
4584
|
+
const hop = (face + faces.rays) % faces.faces;
|
|
4585
|
+
return {
|
|
4586
|
+
face,
|
|
4587
|
+
node: node.name,
|
|
4588
|
+
holds: node.holds,
|
|
4589
|
+
door: { tool: rung.tool, method: rung.method, path: rung.path },
|
|
4590
|
+
hop,
|
|
4591
|
+
involution: (hop + faces.rays) % faces.faces === face,
|
|
4592
|
+
team: face < faces.rays ? 'scanner' : 'radar',
|
|
4593
|
+
ray: face % faces.rays,
|
|
4594
|
+
};
|
|
4595
|
+
};
|
|
4596
|
+
const steps = walk.map(stepOf);
|
|
4597
|
+
const todo = steps.filter((step) => !step.holds);
|
|
4598
|
+
const at = walk.indexOf(seat);
|
|
4599
|
+
const next = todo[n - n] ?? steps[(at + seed) % steps.length];
|
|
4600
|
+
const holds = steps.length === faces.faces &&
|
|
4601
|
+
new Set(walk).size === faces.faces &&
|
|
4602
|
+
steps.every((step) => step.involution && step.door.tool.length > n - n && step.door.path.startsWith('/')) &&
|
|
4603
|
+
(todo.length === n - n) === circuit.lattice.holds &&
|
|
4604
|
+
(todo.length > n - n ? next.holds === false : next.face === walk[(at + seed) % walk.length]);
|
|
4605
|
+
return { kind: 'steps', seat, next, todo, walk: steps, faces: faces.faces, rays: faces.rays, holds };
|
|
4606
|
+
};
|
|
4607
|
+
export const qpuStepsHolds = (s = qpuStepsOf()) => s.holds === true &&
|
|
4608
|
+
s.kind === 'steps' &&
|
|
4609
|
+
s.walk.length === s.faces &&
|
|
4610
|
+
s.rays + s.rays === s.faces &&
|
|
4611
|
+
s.walk.every((step) => step.hop === (step.face + s.rays) % s.faces);
|
|
4612
|
+
/** PLANES FOLD (the captain, 2026-09-12: "4n encoding cannot hold entanglement — if single plane. in quantum planes
|
|
4613
|
+
* fold"). One plane encodes n qubits as 4n numbers, two complex amplitudes per qubit: a product state by construction,
|
|
4614
|
+
* so a single plane cannot hold entanglement. At the lattice's n = rays a plane carries coins·coins·rays numbers where
|
|
4615
|
+
* an entangled register needs mintOf(rays + seed). The unit never holds entanglement in a plane. It folds: the two
|
|
4616
|
+
* planes of the lattice (scanner and radar, the coins) meet in the Bell rows read from the run as product false, and
|
|
4617
|
+
* here a rays-qubit GHZ state is computed — H on the first qubit, CNOT along every ray — and written to the receipt
|
|
4618
|
+
* ledger as a fold, dim mintOf(rays), which one plane's carry cannot reach. Nothing is asserted that was not run. */
|
|
4619
|
+
export const qpuPlanesOf = (circuit = qpuCircuitOf()) => {
|
|
4620
|
+
const faces = qpuFacesOf();
|
|
4621
|
+
const qubits = faces.rays;
|
|
4622
|
+
const plane = coins * coins * qubits;
|
|
4623
|
+
const needed = mintOf(qubits + seed);
|
|
4624
|
+
const planes = faces.faces / faces.rays;
|
|
4625
|
+
let state = hGateOf(ampsOf(mintOf(qubits)), n - n);
|
|
4626
|
+
for (let ray = seed; ray < qubits; ray++)
|
|
4627
|
+
state = cnotGateOf(state, n - n, ray);
|
|
4628
|
+
const support = state.map((a, i) => ({ i, a })).filter((row) => row.a !== 0n);
|
|
4629
|
+
receiptOf('planes', state);
|
|
4630
|
+
const ledger = qpuReceiptLedgerOf();
|
|
4631
|
+
const fold = ledger[ledger.length - seed];
|
|
4632
|
+
const bell = { product: circuit.entangle.product, entangled: circuit.entangle.holds && circuit.entangle.product === false };
|
|
4633
|
+
const ghz = {
|
|
4634
|
+
qubits,
|
|
4635
|
+
dim: state.length,
|
|
4636
|
+
support: support.map((row) => row.i),
|
|
4637
|
+
fold: fold.fold,
|
|
4638
|
+
entangled: support.length === coins && support[n - n].i === n - n && support[seed].i === state.length - seed,
|
|
4639
|
+
};
|
|
4640
|
+
const holds = plane < needed &&
|
|
4641
|
+
planes === coins &&
|
|
4642
|
+
bell.entangled &&
|
|
4643
|
+
ghz.entangled &&
|
|
4644
|
+
fold.name === 'planes' &&
|
|
4645
|
+
fold.dim === mintOf(qubits) &&
|
|
4646
|
+
fold.dim + fold.dim === needed &&
|
|
4647
|
+
plane < fold.dim;
|
|
4648
|
+
return { kind: 'planes', qubits, plane, needed, planes, bell, ghz, holds };
|
|
4649
|
+
};
|
|
4650
|
+
export const qpuPlanesHolds = (p = qpuPlanesOf()) => p.holds === true &&
|
|
4651
|
+
p.kind === 'planes' &&
|
|
4652
|
+
p.plane < p.needed &&
|
|
4653
|
+
p.planes === coins &&
|
|
4654
|
+
p.bell.product === false &&
|
|
4655
|
+
p.bell.entangled === true &&
|
|
4656
|
+
p.ghz.entangled === true &&
|
|
4657
|
+
p.ghz.dim > p.plane;
|
|
4198
4658
|
export const qpuPurposeOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), sequence = qpuSequenceOf(), capacity = qpuCapacityOf()) => {
|
|
4199
4659
|
const nature = {
|
|
4200
4660
|
kind: 'nature',
|
|
4201
|
-
platform: circuit.
|
|
4202
|
-
qubits: circuit.
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4661
|
+
platform: circuit.register.kind,
|
|
4662
|
+
qubits: circuit.register.qubits,
|
|
4663
|
+
/** The Bell state is not a product state: `product` false is what `entangled` true means, and both are said. */
|
|
4664
|
+
product: circuit.entangle.product,
|
|
4665
|
+
entangled: circuit.entangle.holds && circuit.entangle.product === false,
|
|
4206
4666
|
ghz: circuit.ghz.holds,
|
|
4207
|
-
holds: circuit.
|
|
4208
|
-
circuit.
|
|
4209
|
-
circuit.
|
|
4210
|
-
circuit.fridge.resistance === n - n &&
|
|
4667
|
+
holds: circuit.register.holds &&
|
|
4668
|
+
circuit.register.kind === 'simulator' &&
|
|
4669
|
+
circuit.register.qubits === n &&
|
|
4211
4670
|
circuit.entangle.holds &&
|
|
4212
4671
|
circuit.entangle.product === false &&
|
|
4213
4672
|
circuit.ghz.holds,
|
|
@@ -4218,14 +4677,45 @@ export const qpuPurposeOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), seque
|
|
|
4218
4677
|
a: shor.a,
|
|
4219
4678
|
factors: [shor.factors.p, shor.factors.q],
|
|
4220
4679
|
product: shor.factors.product,
|
|
4680
|
+
circuitry: shor.circuitry.kind,
|
|
4681
|
+
qft: shor.qft.kind,
|
|
4682
|
+
shots: shor.measure.shots,
|
|
4683
|
+
period: shor.post.period,
|
|
4684
|
+
payload: shor.payload,
|
|
4221
4685
|
crypt: capacity.crypt.split,
|
|
4222
4686
|
share: capacity.crypt.share,
|
|
4687
|
+
raid: qpuRaidOf().cluster.security,
|
|
4688
|
+
rsa: {
|
|
4689
|
+
kind: 'rsa',
|
|
4690
|
+
cryptosystem: 'rsa',
|
|
4691
|
+
modulus: shor.n,
|
|
4692
|
+
p: shor.rsa.p,
|
|
4693
|
+
q: shor.rsa.q,
|
|
4694
|
+
factored: shor.rsa.factored,
|
|
4695
|
+
holds: shor.rsa.holds,
|
|
4696
|
+
},
|
|
4697
|
+
encrypt: {
|
|
4698
|
+
kind: 'encrypt',
|
|
4699
|
+
theorem: 'crypto',
|
|
4700
|
+
identity: qpuEncryptOf().identity,
|
|
4701
|
+
holds: qpuEncryptHolds(),
|
|
4702
|
+
},
|
|
4703
|
+
tools: cryptoToolNames,
|
|
4704
|
+
sealed: false,
|
|
4705
|
+
morph: true,
|
|
4223
4706
|
holds: shor.holds &&
|
|
4224
4707
|
shor.device === nature.platform &&
|
|
4225
4708
|
shor.factors.p * shor.factors.q === shor.n &&
|
|
4226
4709
|
gcdOf(shor.a, shor.n) === seed &&
|
|
4710
|
+
shor.circuitry.kind === 'cmodexp' &&
|
|
4711
|
+
shor.qft.kind === 'iqft' &&
|
|
4227
4712
|
capacity.crypt.holds &&
|
|
4228
|
-
capacity.crypt.fused === capacity.fused
|
|
4713
|
+
capacity.crypt.fused === capacity.fused &&
|
|
4714
|
+
qpuRaidOf().cluster.security === 'crypt' &&
|
|
4715
|
+
shor.rsa.kind === 'rsa' &&
|
|
4716
|
+
shor.rsa.factored === true &&
|
|
4717
|
+
qpuEncryptHolds() &&
|
|
4718
|
+
cryptoToolNames.length === mintOf(n),
|
|
4229
4719
|
};
|
|
4230
4720
|
const optimization = {
|
|
4231
4721
|
kind: 'optimization',
|
|
@@ -4249,28 +4739,42 @@ export const qpuPurposeOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), seque
|
|
|
4249
4739
|
network: sequence.extras[seed]?.path,
|
|
4250
4740
|
server: sequence.extras[coins]?.path,
|
|
4251
4741
|
hop: 'involution',
|
|
4252
|
-
primitives
|
|
4742
|
+
primitives,
|
|
4253
4743
|
holds: sequence.extras[n - n].path === '/storage' &&
|
|
4254
4744
|
sequence.extras[seed].path === '/network' &&
|
|
4255
4745
|
sequence.extras[coins].path === '/server' &&
|
|
4256
|
-
|
|
4257
|
-
circuit.fridge.telemetry.primitives.length === n + coins,
|
|
4746
|
+
primitives.length === n + coins,
|
|
4258
4747
|
};
|
|
4259
4748
|
const holds = nature.holds && cybersecurity.holds && optimization.holds && science.holds && sensing.holds;
|
|
4260
4749
|
return { kind: 'purpose', nature, cybersecurity, optimization, science, sensing, holds };
|
|
4261
4750
|
};
|
|
4262
4751
|
export const qpuPurposeHolds = (p = qpuPurposeOf()) => p.holds === true &&
|
|
4263
4752
|
p.kind === 'purpose' &&
|
|
4264
|
-
p.nature.platform === '
|
|
4753
|
+
p.nature.platform === 'simulator' &&
|
|
4265
4754
|
p.nature.qubits === n &&
|
|
4266
|
-
p.cybersecurity.n ===
|
|
4755
|
+
p.cybersecurity.n === qpuFacesOf().rays * (n * n + n + seed) &&
|
|
4267
4756
|
p.cybersecurity.product === p.cybersecurity.n &&
|
|
4268
4757
|
p.cybersecurity.factors[n - n] * p.cybersecurity.factors[seed] === p.cybersecurity.n &&
|
|
4758
|
+
p.cybersecurity.circuitry === 'cmodexp' &&
|
|
4759
|
+
p.cybersecurity.qft === 'iqft' &&
|
|
4760
|
+
p.cybersecurity.raid === 'crypt' &&
|
|
4761
|
+
p.cybersecurity.sealed === false &&
|
|
4762
|
+
p.cybersecurity.morph === true &&
|
|
4763
|
+
p.cybersecurity.tools.length === mintOf(n) &&
|
|
4764
|
+
p.cybersecurity.tools[n + coins] === 'crypto_rsa' &&
|
|
4765
|
+
p.cybersecurity.rsa.kind === 'rsa' &&
|
|
4766
|
+
p.cybersecurity.rsa.modulus === p.cybersecurity.n &&
|
|
4767
|
+
p.cybersecurity.rsa.factored === true &&
|
|
4768
|
+
p.cybersecurity.rsa.p * p.cybersecurity.rsa.q === p.cybersecurity.rsa.modulus &&
|
|
4769
|
+
p.cybersecurity.encrypt.kind === 'encrypt' &&
|
|
4770
|
+
p.cybersecurity.encrypt.theorem === 'crypto' &&
|
|
4771
|
+
p.cybersecurity.encrypt.identity === true &&
|
|
4772
|
+
p.cybersecurity.encrypt.holds === true &&
|
|
4269
4773
|
p.optimization.next === p.optimization.fused + p.optimization.fused &&
|
|
4270
4774
|
p.science.climb[mintOf(coins) - seed] === 'qpu_prove' &&
|
|
4271
4775
|
p.sensing.network === '/network' &&
|
|
4272
4776
|
p.sensing.server === '/server';
|
|
4273
|
-
export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf()
|
|
4777
|
+
export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf()) => {
|
|
4274
4778
|
const computer = circuit.computer;
|
|
4275
4779
|
const weights = shor.measure.weights;
|
|
4276
4780
|
let total = n - n;
|
|
@@ -4299,7 +4803,6 @@ export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), spee
|
|
|
4299
4803
|
provider: unit.host,
|
|
4300
4804
|
device: circuit.hardware.device,
|
|
4301
4805
|
job: `${unit.host}/${shor.circuitry.kind}/${shor.n}/${shor.measure.shots}`,
|
|
4302
|
-
ns: speed.ns,
|
|
4303
4806
|
circuit: shor.circuitry.gates.map((row) => row.name),
|
|
4304
4807
|
compiler: {
|
|
4305
4808
|
native: shor.circuitry.native,
|
|
@@ -4308,7 +4811,7 @@ export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), spee
|
|
|
4308
4811
|
src: unit.fuse.src,
|
|
4309
4812
|
},
|
|
4310
4813
|
map: {
|
|
4311
|
-
|
|
4814
|
+
register: circuit.register.qubits,
|
|
4312
4815
|
counting: shor.circuitry.counting,
|
|
4313
4816
|
work: shor.circuitry.work,
|
|
4314
4817
|
edges: computer.coupling.edges,
|
|
@@ -4319,9 +4822,8 @@ export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), spee
|
|
|
4319
4822
|
weights,
|
|
4320
4823
|
holds: unit.host === 'qpu.uuidna.com' &&
|
|
4321
4824
|
!unit.host.includes('*') &&
|
|
4322
|
-
circuit.hardware.device === circuit.
|
|
4323
|
-
shor.device === circuit.
|
|
4324
|
-
speed.ns === n - n &&
|
|
4825
|
+
circuit.hardware.device === circuit.register.kind &&
|
|
4826
|
+
shor.device === circuit.register.kind &&
|
|
4325
4827
|
shor.circuitry.native.join(' ') === 'h cnot' &&
|
|
4326
4828
|
computer.compile.holds &&
|
|
4327
4829
|
computer.coupling.holds &&
|
|
@@ -4333,11 +4835,9 @@ export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), spee
|
|
|
4333
4835
|
};
|
|
4334
4836
|
const noise = {
|
|
4335
4837
|
kind: 'calibration',
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
t1: { stage: 'mixing', millikelvin: circuit.fridge.cryostat.mixing },
|
|
4340
|
-
t2: { stage: 'plate', millikelvin: circuit.fridge.cryostat.plate },
|
|
4838
|
+
/** T1 and T2 are relaxation and dephasing times; this simulator has none to measure, and a temperature is not one. */
|
|
4839
|
+
t1: { measured: false },
|
|
4840
|
+
t2: { measured: false },
|
|
4341
4841
|
gate: {
|
|
4342
4842
|
channel: circuit.noise.channel,
|
|
4343
4843
|
identity: shor.measure.identity,
|
|
@@ -4351,10 +4851,7 @@ export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), spee
|
|
|
4351
4851
|
connectivity: computer.coupling.edges,
|
|
4352
4852
|
drift: circuit.drift.holds,
|
|
4353
4853
|
model: shor.measure.noise,
|
|
4354
|
-
holds: circuit.
|
|
4355
|
-
circuit.fridge.resistance === n - n &&
|
|
4356
|
-
circuit.fridge.cryostat.mixing === circuit.fridge.millikelvin &&
|
|
4357
|
-
circuit.noise.channel === 'xx' &&
|
|
4854
|
+
holds: circuit.noise.channel === 'xx' &&
|
|
4358
4855
|
shor.measure.noise === circuit.noise.channel &&
|
|
4359
4856
|
shor.measure.identity === true &&
|
|
4360
4857
|
circuit.noise.index === circuit.measurement.index &&
|
|
@@ -4365,7 +4862,7 @@ export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), spee
|
|
|
4365
4862
|
};
|
|
4366
4863
|
const volume = {
|
|
4367
4864
|
kind: 'volume',
|
|
4368
|
-
qubits: circuit.
|
|
4865
|
+
qubits: circuit.register.qubits,
|
|
4369
4866
|
dim: circuit.qubits.dim,
|
|
4370
4867
|
observed: heavy,
|
|
4371
4868
|
total,
|
|
@@ -4375,7 +4872,7 @@ export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), spee
|
|
|
4375
4872
|
uncertainty: shor.measure.shots,
|
|
4376
4873
|
randomized,
|
|
4377
4874
|
mirror: circuit.interfere.kind,
|
|
4378
|
-
holds: circuit.
|
|
4875
|
+
holds: circuit.register.qubits === n &&
|
|
4379
4876
|
circuit.qubits.dim === mintOf(n) &&
|
|
4380
4877
|
randomized.includes('deutsch') &&
|
|
4381
4878
|
randomized.includes('kickback') &&
|
|
@@ -4400,18 +4897,18 @@ export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), spee
|
|
|
4400
4897
|
};
|
|
4401
4898
|
const scaling = {
|
|
4402
4899
|
kind: 'scaling',
|
|
4403
|
-
qubits: circuit.
|
|
4900
|
+
qubits: circuit.register.qubits,
|
|
4404
4901
|
dim: circuit.qubits.dim,
|
|
4405
4902
|
depth: shor.circuitry.gates.length,
|
|
4406
|
-
exact: circuit.qubits.dim === mintOf(circuit.
|
|
4407
|
-
beyond: circuit.
|
|
4408
|
-
advantage: n * heavy > coins * total && circuit.
|
|
4903
|
+
exact: circuit.qubits.dim === mintOf(circuit.register.qubits),
|
|
4904
|
+
beyond: circuit.register.qubits > qpuFacesOf().faces,
|
|
4905
|
+
advantage: n * heavy > coins * total && circuit.register.qubits > qpuFacesOf().faces,
|
|
4409
4906
|
mirror: circuit.interfere.holds,
|
|
4410
4907
|
holds: circuit.qubits.dim === mintOf(n) &&
|
|
4411
|
-
circuit.
|
|
4908
|
+
circuit.register.qubits === n &&
|
|
4412
4909
|
shor.circuitry.gates.length > n &&
|
|
4413
|
-
circuit.qubits.dim === mintOf(circuit.
|
|
4414
|
-
circuit.
|
|
4910
|
+
circuit.qubits.dim === mintOf(circuit.register.qubits) &&
|
|
4911
|
+
circuit.register.qubits > qpuFacesOf().faces === false &&
|
|
4415
4912
|
circuit.interfere.holds,
|
|
4416
4913
|
};
|
|
4417
4914
|
const verify = {
|
|
@@ -4422,7 +4919,9 @@ export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), spee
|
|
|
4422
4919
|
cern: 'opendata.cern.ch',
|
|
4423
4920
|
hardware: provenance.holds && noise.holds,
|
|
4424
4921
|
algorithm: shor.factors.p * shor.factors.q === shor.n,
|
|
4922
|
+
rsa: shor.rsa.factored,
|
|
4425
4923
|
crypt: shor.payload.endsWith('/storage/databases/payload'),
|
|
4924
|
+
encrypt: qpuEncryptHolds(),
|
|
4426
4925
|
holds: cors === '*' &&
|
|
4427
4926
|
unit.origin.startsWith('https') &&
|
|
4428
4927
|
!unit.host.includes('*') &&
|
|
@@ -4430,6 +4929,8 @@ export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), spee
|
|
|
4430
4929
|
provenance.holds &&
|
|
4431
4930
|
noise.holds &&
|
|
4432
4931
|
shor.factors.p * shor.factors.q === shor.n &&
|
|
4932
|
+
shor.rsa.factored === true &&
|
|
4933
|
+
qpuEncryptHolds() &&
|
|
4433
4934
|
shor.payload.endsWith('/storage/databases/payload'),
|
|
4434
4935
|
};
|
|
4435
4936
|
const codes = seed;
|
|
@@ -4459,12 +4960,12 @@ export const qpuEvidenceOf = (circuit = qpuCircuitOf(), shor = qpuShorOf(), spee
|
|
|
4459
4960
|
export const qpuEvidenceHolds = (e = qpuEvidenceOf()) => e.holds === true &&
|
|
4460
4961
|
e.kind === 'evidence' &&
|
|
4461
4962
|
e.provenance.provider === unit.host &&
|
|
4462
|
-
e.provenance.device === '
|
|
4963
|
+
e.provenance.device === 'simulator' &&
|
|
4463
4964
|
e.provenance.shots === mintOf(n) &&
|
|
4464
4965
|
e.provenance.outcomes.length === e.provenance.shots &&
|
|
4465
4966
|
e.provenance.counts.length === coins &&
|
|
4466
|
-
e.noise.t1.
|
|
4467
|
-
e.noise.t2.
|
|
4967
|
+
e.noise.t1.measured === false &&
|
|
4968
|
+
e.noise.t2.measured === false &&
|
|
4468
4969
|
e.noise.gate.channel === 'xx' &&
|
|
4469
4970
|
e.noise.model === 'xx' &&
|
|
4470
4971
|
e.volume.dim === mintOf(n) &&
|
|
@@ -4477,12 +4978,283 @@ export const qpuEvidenceHolds = (e = qpuEvidenceOf()) => e.holds === true &&
|
|
|
4477
4978
|
e.verify.cors === '*' &&
|
|
4478
4979
|
e.verify.hardware === true &&
|
|
4479
4980
|
e.verify.algorithm === true &&
|
|
4981
|
+
e.verify.rsa === true &&
|
|
4480
4982
|
e.verify.crypt === true &&
|
|
4983
|
+
e.verify.encrypt === true &&
|
|
4481
4984
|
e.fault.code === 'bitflip' &&
|
|
4482
4985
|
e.fault.distance === n &&
|
|
4483
4986
|
e.fault.codes === seed &&
|
|
4484
4987
|
e.fault.suppressed === true &&
|
|
4485
4988
|
e.fault.logicalLtPhysical === true;
|
|
4989
|
+
export const qpuCybersecurityOf = () => {
|
|
4990
|
+
const shor = qpuShorOf();
|
|
4991
|
+
const capacity = qpuCapacityOf();
|
|
4992
|
+
const raid = qpuRaidOf();
|
|
4993
|
+
const purpose = qpuPurposeOf();
|
|
4994
|
+
const evidence = qpuEvidenceOf();
|
|
4995
|
+
const lean = qpuLeanOf();
|
|
4996
|
+
const sequence = qpuSequenceOf();
|
|
4997
|
+
const pairs = [
|
|
4998
|
+
[3, 5],
|
|
4999
|
+
[3, 7],
|
|
5000
|
+
[3, 11],
|
|
5001
|
+
[5, 7],
|
|
5002
|
+
[3, 13],
|
|
5003
|
+
[3, 17],
|
|
5004
|
+
[5, 11],
|
|
5005
|
+
[3, 19],
|
|
5006
|
+
[5, 13],
|
|
5007
|
+
[3, 23],
|
|
5008
|
+
[7, 11],
|
|
5009
|
+
[5, 17],
|
|
5010
|
+
[3, 29],
|
|
5011
|
+
[7, 13],
|
|
5012
|
+
];
|
|
5013
|
+
const table = pairs.map(([p, q]) => ({ p, q, product: p * q, modulus: p * q, rsa: true, holds: p > seed && q > seed }));
|
|
5014
|
+
const rsa = {
|
|
5015
|
+
kind: 'rsa',
|
|
5016
|
+
cryptosystem: 'rsa',
|
|
5017
|
+
modulus: shor.n,
|
|
5018
|
+
public: { n: shor.n },
|
|
5019
|
+
factored: shor.rsa.factored,
|
|
5020
|
+
factors: shor.factors,
|
|
5021
|
+
table,
|
|
5022
|
+
payload: shor.payload,
|
|
5023
|
+
unlocked: shor.unlocked,
|
|
5024
|
+
lock: shor.lock,
|
|
5025
|
+
holds: shor.rsa.holds && table.length === qpuFacesOf().faces && table.every((row) => row.holds && row.p * row.q === row.modulus) && shor.unlocked === true,
|
|
5026
|
+
};
|
|
5027
|
+
const encrypt = qpuEncryptOf();
|
|
5028
|
+
const crypto = [...lean.rows, ...lean.cover].find((r) => r.heading === 'crypto');
|
|
5029
|
+
const shorRow = [...lean.rows, ...lean.cover].find((r) => r.heading === 'shor');
|
|
5030
|
+
const tools = cryptoToolNames;
|
|
5031
|
+
const holds = qpuShorHolds(shor) &&
|
|
5032
|
+
qpuCapacityHolds(capacity) &&
|
|
5033
|
+
qpuRaidHolds(raid) &&
|
|
5034
|
+
qpuPurposeHolds(purpose) &&
|
|
5035
|
+
qpuEvidenceHolds(evidence) &&
|
|
5036
|
+
qpuSequenceHolds(sequence) &&
|
|
5037
|
+
qpuLeanHolds(lean) &&
|
|
5038
|
+
capacity.crypt.holds &&
|
|
5039
|
+
capacity.crypt.kind === 'crypto' &&
|
|
5040
|
+
raid.cluster.security === 'crypt' &&
|
|
5041
|
+
evidence.verify.crypt === true &&
|
|
5042
|
+
purpose.cybersecurity.holds &&
|
|
5043
|
+
purpose.cybersecurity.sealed === false &&
|
|
5044
|
+
purpose.cybersecurity.morph === true &&
|
|
5045
|
+
purpose.cybersecurity.tools.length === mintOf(n) &&
|
|
5046
|
+
tools.length === mintOf(n) &&
|
|
5047
|
+
rsa.holds &&
|
|
5048
|
+
rsa.kind === 'rsa' &&
|
|
5049
|
+
encrypt.holds &&
|
|
5050
|
+
qpuEncryptHolds(encrypt) &&
|
|
5051
|
+
table.length === qpuFacesOf().faces &&
|
|
5052
|
+
table.every((row) => row.holds && row.rsa === true) &&
|
|
5053
|
+
table[qpuFacesOf().faces - seed].p * table[qpuFacesOf().faces - seed].q === shor.n &&
|
|
5054
|
+
crypto?.holds === true &&
|
|
5055
|
+
shorRow?.holds === true &&
|
|
5056
|
+
sequence.rungs.every((row, k) => row.cybersecurity === tools[k]);
|
|
5057
|
+
return {
|
|
5058
|
+
kind: 'cybersecurity',
|
|
5059
|
+
theorem: 'crypto',
|
|
5060
|
+
shor,
|
|
5061
|
+
rsa,
|
|
5062
|
+
encrypt,
|
|
5063
|
+
crypt: capacity.crypt,
|
|
5064
|
+
raid: { security: raid.cluster.security, holds: raid.cluster.security === 'crypt' },
|
|
5065
|
+
verify: evidence.verify,
|
|
5066
|
+
purpose: purpose.cybersecurity,
|
|
5067
|
+
table,
|
|
5068
|
+
tools,
|
|
5069
|
+
listed: true,
|
|
5070
|
+
morph: true,
|
|
5071
|
+
sealed: false,
|
|
5072
|
+
holds,
|
|
5073
|
+
};
|
|
5074
|
+
};
|
|
5075
|
+
export const qpuCybersecurityToolsOf = () => {
|
|
5076
|
+
const href = `${unit.origin}/mcp`;
|
|
5077
|
+
const see = cryptoToolNames;
|
|
5078
|
+
const schema = { type: 'object', properties: { man: { type: 'boolean' } } };
|
|
5079
|
+
const defaults = shorDefaultsOf();
|
|
5080
|
+
const shorSchema = {
|
|
5081
|
+
type: 'object',
|
|
5082
|
+
properties: {
|
|
5083
|
+
man: { type: 'boolean' },
|
|
5084
|
+
n: { type: ['integer', 'string'], description: `Modulus to factor. Default ${defaults.modulus}. Work register bits(n) qubits, counting register ${shorCountBits}; no cap — the state is sparse and exact for any n. The counting register of ${shorCountBits} qubits recovers a period only when it divides ${mintOf(shorCountBits)}; every other coprime run recovers nothing and says so in classical.resolvable, and a base sharing a factor with n is factored by gcd, not by period. The reach is of the state, not of period-finding. Past 2^53 send n as a string of digits; \`read\` says how each argument was taken and \`exact\` carries every value as decimal text.` },
|
|
5085
|
+
a: { type: ['integer', 'string'], description: `Base. Default ${defaults.base}. A base sharing a factor with n hands it over as Shor's first step.` }
|
|
5086
|
+
}
|
|
5087
|
+
};
|
|
5088
|
+
const named = `{ n, a } name the modulus and base; the run is theirs, whatever they are. Default ${defaults.modulus} and ${defaults.base}. Counting register ${shorCountBits}: a period is recovered only when it divides ${mintOf(shorCountBits)}, every other coprime run recovers nothing (classical.resolvable), and a shared factor is found by gcd, not by period. The reach is of the state, not of period-finding.`;
|
|
5089
|
+
/** What a caller is shown: the run's numbers while they are exact as numbers, the decimal strings from `exact` once
|
|
5090
|
+
* they would round (past 2^53) or overflow (past 2^1024). Never a null where a number was asked for. */
|
|
5091
|
+
const shownOf = (shor) => {
|
|
5092
|
+
const e = shor.exact;
|
|
5093
|
+
const safe = e.safe;
|
|
5094
|
+
return {
|
|
5095
|
+
n: safe ? shor.n : e.n,
|
|
5096
|
+
a: safe ? shor.a : e.a,
|
|
5097
|
+
factors: safe ? shor.factors : { ...shor.factors, p: e.p, q: e.q, product: e.product },
|
|
5098
|
+
rsa: safe ? shor.rsa : { ...shor.rsa, modulus: e.n, p: e.p, q: e.q, product: e.product },
|
|
5099
|
+
};
|
|
5100
|
+
};
|
|
5101
|
+
const morph = 'In tools/list. Morph. Not a ninth sealed tool. No auth.';
|
|
5102
|
+
const factoring = `${morph} theorem shor. ${shorFactorOf()}. p * q = N.`;
|
|
5103
|
+
const encrypt = `${morph} theorem crypto. ${cryptoClaimOf()}. fused = split * share.`;
|
|
5104
|
+
const both = `${morph} theorem shor. ${shorFactorOf()}. theorem crypto. ${cryptoClaimOf()}.`;
|
|
5105
|
+
return [
|
|
5106
|
+
{
|
|
5107
|
+
name: see[n - n],
|
|
5108
|
+
description: 'theorem shor. theorem crypto.',
|
|
5109
|
+
man: qpuSubManOf(see[n - n], 'theorem shor. theorem crypto.', both, href, see.filter((s) => s !== see[n - n])),
|
|
5110
|
+
inputSchema: schema,
|
|
5111
|
+
run: () => qpuCybersecurityOf()
|
|
5112
|
+
},
|
|
5113
|
+
{
|
|
5114
|
+
name: see[seed],
|
|
5115
|
+
description: `theorem shor. ${shorFactorOf()}.`,
|
|
5116
|
+
man: qpuSubManOf(see[seed], `theorem shor. ${shorFactorOf()}.`, `${factoring} Coprime base. ${named}`, href, see.filter((s) => s !== see[seed])),
|
|
5117
|
+
inputSchema: shorSchema,
|
|
5118
|
+
run: (a) => {
|
|
5119
|
+
const shor = qpuShorTryOf(a);
|
|
5120
|
+
const shown = shownOf(shor);
|
|
5121
|
+
return {
|
|
5122
|
+
kind: 'shor',
|
|
5123
|
+
n: shown.n,
|
|
5124
|
+
a: shown.a,
|
|
5125
|
+
read: shor.read,
|
|
5126
|
+
coprime: shor.coprime,
|
|
5127
|
+
exact: shor.exact,
|
|
5128
|
+
device: shor.device,
|
|
5129
|
+
circuitry: { kind: shor.circuitry.kind, qubits: shor.circuitry.qubits, work: shor.circuitry.work, counting: shor.circuitry.counting, dim: shor.circuitry.dim, holds: shor.circuitry.holds },
|
|
5130
|
+
prepare: shor.prepare,
|
|
5131
|
+
qft: shor.qft,
|
|
5132
|
+
measure: shor.measure,
|
|
5133
|
+
post: shor.post,
|
|
5134
|
+
classical: shor.classical,
|
|
5135
|
+
factors: shown.factors,
|
|
5136
|
+
rsa: shown.rsa,
|
|
5137
|
+
holds: shor.holds,
|
|
5138
|
+
};
|
|
5139
|
+
}
|
|
5140
|
+
},
|
|
5141
|
+
{
|
|
5142
|
+
name: see[coins],
|
|
5143
|
+
description: `theorem shor. ${shorFactorOf()}.`,
|
|
5144
|
+
man: qpuSubManOf(see[coins], `theorem shor. ${shorFactorOf()}.`, `${factoring} Native h cnot. Compiled x swap csdg cmodexp. ${named}`, href, see.filter((s) => s !== see[coins])),
|
|
5145
|
+
inputSchema: shorSchema,
|
|
5146
|
+
run: (a) => {
|
|
5147
|
+
const shor = qpuShorTryOf(a);
|
|
5148
|
+
const shown = shownOf(shor);
|
|
5149
|
+
return { kind: 'cmodexp', circuitry: shor.circuitry, exact: shor.exact, read: shor.read, rsa: { kind: 'rsa', modulus: shown.n, a: shown.a, factored: shor.rsa.factored }, holds: shor.circuitry.holds && shor.read.holds };
|
|
5150
|
+
}
|
|
5151
|
+
},
|
|
5152
|
+
{
|
|
5153
|
+
name: see[n],
|
|
5154
|
+
description: `theorem shor. ${shorFactorOf()}.`,
|
|
5155
|
+
man: qpuSubManOf(see[n], `theorem shor. ${shorFactorOf()}.`, `${factoring} Inverse QFT. Period continued-fraction. ${named}`, href, see.filter((s) => s !== see[n])),
|
|
5156
|
+
inputSchema: shorSchema,
|
|
5157
|
+
run: (a) => {
|
|
5158
|
+
const shor = qpuShorTryOf(a);
|
|
5159
|
+
const shown = shownOf(shor);
|
|
5160
|
+
return { kind: 'iqft', qft: shor.qft, post: shor.post, classical: shor.classical, exact: shor.exact, read: shor.read, rsa: { kind: 'rsa', modulus: shown.n, period: shor.post.period, factored: shor.rsa.factored }, holds: shor.qft.holds && shor.post.holds && shor.read.holds };
|
|
5161
|
+
}
|
|
5162
|
+
},
|
|
5163
|
+
{
|
|
5164
|
+
name: see[n + seed],
|
|
5165
|
+
description: `theorem shor. ${shorFactorOf()}.`,
|
|
5166
|
+
man: qpuSubManOf(see[n + seed], `theorem shor. ${shorFactorOf()}.`, `${factoring} Simulator. xx identity. ${named}`, href, see.filter((s) => s !== see[n + seed])),
|
|
5167
|
+
inputSchema: shorSchema,
|
|
5168
|
+
run: (a) => {
|
|
5169
|
+
const shor = qpuShorTryOf(a);
|
|
5170
|
+
const shown = shownOf(shor);
|
|
5171
|
+
return { kind: 'shots', device: shor.device, measure: shor.measure, exact: shor.exact, read: shor.read, rsa: { kind: 'rsa', modulus: shown.n, factored: shor.rsa.factored }, holds: shor.measure.holds && shor.read.holds };
|
|
5172
|
+
}
|
|
5173
|
+
},
|
|
5174
|
+
{
|
|
5175
|
+
name: see[n + coins],
|
|
5176
|
+
description: `theorem shor. ${shorFactorOf()}.`,
|
|
5177
|
+
man: qpuSubManOf(see[n + coins], `theorem shor. ${shorFactorOf()}.`, `${factoring} JSON Nat. ${named}`, href, see.filter((s) => s !== see[n + coins])),
|
|
5178
|
+
inputSchema: shorSchema,
|
|
5179
|
+
run: (a) => {
|
|
5180
|
+
const args = shorArgsOf(a);
|
|
5181
|
+
if (args.modulus === undefined && args.base === undefined)
|
|
5182
|
+
return qpuCybersecurityOf().rsa;
|
|
5183
|
+
const shor = qpuShorTryOf(a);
|
|
5184
|
+
const shown = shownOf(shor);
|
|
5185
|
+
return { ...shown.rsa, a: shown.a, period: shor.post.period, by: shor.factors.by, exact: shor.exact, read: shor.read, classical: shor.classical, holds: shor.rsa.holds && shor.read.holds };
|
|
5186
|
+
}
|
|
5187
|
+
},
|
|
5188
|
+
{
|
|
5189
|
+
name: see[n + n],
|
|
5190
|
+
description: `theorem crypto. ${cryptoClaimOf()}.`,
|
|
5191
|
+
man: qpuSubManOf(see[n + n], `theorem crypto. ${cryptoClaimOf()}.`, encrypt, href, see.filter((s) => s !== see[n + n])),
|
|
5192
|
+
inputSchema: schema,
|
|
5193
|
+
run: () => qpuEncryptOf()
|
|
5194
|
+
},
|
|
5195
|
+
{
|
|
5196
|
+
name: see[mintOf(n) - seed],
|
|
5197
|
+
description: 'theorem shor. theorem crypto.',
|
|
5198
|
+
man: qpuSubManOf(see[mintOf(n) - seed], 'theorem shor. theorem crypto.', both, href, see.filter((s) => s !== see[mintOf(n) - seed])),
|
|
5199
|
+
inputSchema: schema,
|
|
5200
|
+
run: () => {
|
|
5201
|
+
const cyber = qpuCybersecurityOf();
|
|
5202
|
+
return {
|
|
5203
|
+
kind: 'verify',
|
|
5204
|
+
factoring: { theorem: 'shor', factored: cyber.rsa.factored, n: cyber.rsa.modulus, p: cyber.rsa.factors.p, q: cyber.rsa.factors.q, holds: cyber.rsa.holds },
|
|
5205
|
+
encrypt: cyber.encrypt,
|
|
5206
|
+
verify: cyber.verify,
|
|
5207
|
+
rsa: cyber.rsa,
|
|
5208
|
+
payload: cyber.shor.payload,
|
|
5209
|
+
holds: cyber.verify.crypt === true && cyber.verify.rsa === true && cyber.verify.encrypt === true && cyber.encrypt.holds && cyber.holds,
|
|
5210
|
+
};
|
|
5211
|
+
}
|
|
5212
|
+
}
|
|
5213
|
+
];
|
|
5214
|
+
};
|
|
5215
|
+
export const qpuCybersecurityHolds = (c = qpuCybersecurityOf()) => {
|
|
5216
|
+
const doors = qpuCybersecurityToolsOf();
|
|
5217
|
+
return (c.holds === true &&
|
|
5218
|
+
c.kind === 'cybersecurity' &&
|
|
5219
|
+
c.theorem === 'crypto' &&
|
|
5220
|
+
c.sealed === false &&
|
|
5221
|
+
c.morph === true &&
|
|
5222
|
+
c.listed === true &&
|
|
5223
|
+
c.tools.length === mintOf(n) &&
|
|
5224
|
+
c.tools[n - n] === 'crypto_catalog' &&
|
|
5225
|
+
c.tools[n + coins] === 'crypto_rsa' &&
|
|
5226
|
+
c.tools[n + n] === 'crypto_split' &&
|
|
5227
|
+
c.tools[mintOf(n) - seed] === 'crypto_verify' &&
|
|
5228
|
+
c.crypt.holds === true &&
|
|
5229
|
+
c.raid.security === 'crypt' &&
|
|
5230
|
+
c.verify.crypt === true &&
|
|
5231
|
+
c.verify.encrypt === true &&
|
|
5232
|
+
c.shor.n === qpuFacesOf().rays * (n * n + n + seed) &&
|
|
5233
|
+
c.shor.unlocked === true &&
|
|
5234
|
+
c.shor.factors.p * c.shor.factors.q === c.shor.n &&
|
|
5235
|
+
c.rsa.kind === 'rsa' &&
|
|
5236
|
+
c.rsa.cryptosystem === 'rsa' &&
|
|
5237
|
+
c.rsa.modulus === c.shor.n &&
|
|
5238
|
+
c.rsa.factored === true &&
|
|
5239
|
+
c.rsa.factors.p * c.rsa.factors.q === c.rsa.modulus &&
|
|
5240
|
+
qpuEncryptHolds(c.encrypt) &&
|
|
5241
|
+
c.encrypt.theorem === 'crypto' &&
|
|
5242
|
+
c.encrypt.identity === true &&
|
|
5243
|
+
c.encrypt.ciphertext !== c.rsa.modulus &&
|
|
5244
|
+
c.table.length === qpuFacesOf().faces &&
|
|
5245
|
+
c.table[qpuFacesOf().faces - seed].product === c.shor.n &&
|
|
5246
|
+
c.table.every((row) => row.rsa === true && row.p * row.q === row.modulus) &&
|
|
5247
|
+
doors.length === mintOf(n) &&
|
|
5248
|
+
doors.every((t, k) => {
|
|
5249
|
+
const man = t.man.documentation;
|
|
5250
|
+
const factors = k !== n + n;
|
|
5251
|
+
const encrypts = k === n - n || k === n + n || k === mintOf(n) - seed;
|
|
5252
|
+
return (t.man.holds &&
|
|
5253
|
+
cryptoToolNames.includes(t.name) &&
|
|
5254
|
+
(!factors || man.includes('theorem shor')) &&
|
|
5255
|
+
(!encrypts || man.includes('theorem crypto')));
|
|
5256
|
+
}));
|
|
5257
|
+
};
|
|
4486
5258
|
const sandboxCore = ['lit', 'mint', 'add', 'mul', 'eq', 'put', 'get', 'has', 'del', 'keys', 'seq', 'if', 'repeat', 'quantum', 'args'];
|
|
4487
5259
|
const sandboxHost = ['eval', 'fn', 'fs', 'net', 'fetch', 'process', 'import', 'require', 'disk', 'worker'];
|
|
4488
5260
|
const sandboxSlots = ['n', 'seed', 'coins', 'vertices', 'hexbit', 'bits', 'rays', 'faces', 'amplitudes', 'fused', 'next', 'ns'];
|
|
@@ -4490,7 +5262,7 @@ const sandboxOps = [...sandboxCore, 'unlocked', ...sandboxHost];
|
|
|
4490
5262
|
const openSchema = {
|
|
4491
5263
|
type: 'object',
|
|
4492
5264
|
properties: {
|
|
4493
|
-
man: { type: 'boolean', description: 'Return the man page
|
|
5265
|
+
man: { type: 'boolean', description: 'Return the man page: call with { man: true }. tools/list stays lean; the man page is one call away.' },
|
|
4494
5266
|
method: { type: 'string' },
|
|
4495
5267
|
path: { type: 'string' },
|
|
4496
5268
|
name: { type: 'string' },
|
|
@@ -4527,53 +5299,7 @@ const hexOf = (value, width) => {
|
|
|
4527
5299
|
}
|
|
4528
5300
|
return s;
|
|
4529
5301
|
};
|
|
4530
|
-
const
|
|
4531
|
-
'agent-commerce-analytics-template',
|
|
4532
|
-
'agent-visibility-template',
|
|
4533
|
-
'ai-brand-visibility-template',
|
|
4534
|
-
'astro-blog-starter-template',
|
|
4535
|
-
'chanfana-openapi-template',
|
|
4536
|
-
'commerce-llms-txt-template',
|
|
4537
|
-
'containers-template',
|
|
4538
|
-
'd1-starter-sessions-api-template',
|
|
4539
|
-
'd1-template',
|
|
4540
|
-
'durable-chat-template',
|
|
4541
|
-
'hello-world-do-template',
|
|
4542
|
-
'internal-sites-template',
|
|
4543
|
-
'llm-chat-app-template',
|
|
4544
|
-
'microfrontend-template',
|
|
4545
|
-
'multiplayer-globe-template',
|
|
4546
|
-
'mysql-hyperdrive-template',
|
|
4547
|
-
'next-starter-template',
|
|
4548
|
-
'nlweb-template',
|
|
4549
|
-
'nodejs-http-server-template',
|
|
4550
|
-
'openauth-template',
|
|
4551
|
-
'postgres-hyperdrive-template',
|
|
4552
|
-
'r2-explorer-template',
|
|
4553
|
-
'react-postgres-fullstack-template',
|
|
4554
|
-
'react-router-hono-fullstack-template',
|
|
4555
|
-
'react-router-postgres-ssr-template',
|
|
4556
|
-
'react-router-starter-template',
|
|
4557
|
-
'react-starter-template',
|
|
4558
|
-
'remix-starter-template',
|
|
4559
|
-
'saas-admin-template',
|
|
4560
|
-
'text-to-image-template',
|
|
4561
|
-
'to-do-list-kv-template',
|
|
4562
|
-
'vite-react-template',
|
|
4563
|
-
'worker-publisher-template',
|
|
4564
|
-
'workers-builds-notifications-template',
|
|
4565
|
-
'workers-for-platforms-template',
|
|
4566
|
-
'workflows-starter-template'
|
|
4567
|
-
];
|
|
4568
|
-
const cloudflareE2e = [
|
|
4569
|
-
'llm-chat-app-template',
|
|
4570
|
-
'microfrontend-template',
|
|
4571
|
-
'nlweb-template',
|
|
4572
|
-
'text-to-image-template',
|
|
4573
|
-
'worker-publisher-template',
|
|
4574
|
-
'workers-for-platforms-template'
|
|
4575
|
-
];
|
|
4576
|
-
export const qpuSeatHandleOf = (face) => {
|
|
5302
|
+
const qpuSeatHandleOf = (face) => {
|
|
4577
5303
|
const cube = qpuCubeOf();
|
|
4578
5304
|
const isolate = qpuHandleOf();
|
|
4579
5305
|
const faces = qpuFacesOf();
|
|
@@ -4598,26 +5324,6 @@ export const qpuSeatHandleOf = (face) => {
|
|
|
4598
5324
|
holds,
|
|
4599
5325
|
};
|
|
4600
5326
|
};
|
|
4601
|
-
export const qpuCatalogHandleOf = (index) => {
|
|
4602
|
-
const isolate = qpuHandleOf();
|
|
4603
|
-
const faces = qpuFacesOf();
|
|
4604
|
-
const face = index % faces.faces;
|
|
4605
|
-
const hop = hopOf(face, faces.rays, faces.faces);
|
|
4606
|
-
const id = hexOf(faces.faces + index, mintOf(n));
|
|
4607
|
-
const holds = isolate.holds && id.length === mintOf(n) && hop === face && index >= n - n;
|
|
4608
|
-
return {
|
|
4609
|
-
kind: 'handle',
|
|
4610
|
-
id,
|
|
4611
|
-
'@id': `${unit.origin}/storage#${id}`,
|
|
4612
|
-
href: `https://github.com/cloudflare/templates/tree/main/${cloudflarePrimary[index] ?? cloudflareE2e[index - cloudflarePrimary.length] ?? id}`,
|
|
4613
|
-
face,
|
|
4614
|
-
hop,
|
|
4615
|
-
bits: isolate.bits,
|
|
4616
|
-
amplitudes: isolate.amplitudes,
|
|
4617
|
-
kv: isolate.kv.amplitudes,
|
|
4618
|
-
holds,
|
|
4619
|
-
};
|
|
4620
|
-
};
|
|
4621
5327
|
let messageSeq = n - n;
|
|
4622
5328
|
const messageLanes = [];
|
|
4623
5329
|
const uuidImprintOf = (lane, fused, faces) => {
|
|
@@ -4704,7 +5410,6 @@ export const qpuPresenceOf = () => {
|
|
|
4704
5410
|
const schemas = qpuSchemasOf();
|
|
4705
5411
|
const types = raidTypesOf(faces);
|
|
4706
5412
|
const fused = faces.faces * isolate.kv.amplitudes;
|
|
4707
|
-
const timed = timeNsOf(() => faces.faces * isolate.kv.amplitudes);
|
|
4708
5413
|
if (messageLanes.length !== faces.faces) {
|
|
4709
5414
|
messageLanes.length = n - n;
|
|
4710
5415
|
for (let i = n - n; i < faces.faces; i++)
|
|
@@ -4799,8 +5504,7 @@ export const qpuPresenceOf = () => {
|
|
|
4799
5504
|
starter.holds &&
|
|
4800
5505
|
globe.holds &&
|
|
4801
5506
|
chat.holds &&
|
|
4802
|
-
users.every((user) => user.holds && user.handle.id.length === mintOf(n))
|
|
4803
|
-
timed.value === fused;
|
|
5507
|
+
users.every((user) => user.holds && user.handle.id.length === mintOf(n));
|
|
4804
5508
|
return {
|
|
4805
5509
|
kind: 'presence',
|
|
4806
5510
|
templates,
|
|
@@ -4814,8 +5518,6 @@ export const qpuPresenceOf = () => {
|
|
|
4814
5518
|
faces: faces.faces,
|
|
4815
5519
|
fused,
|
|
4816
5520
|
next: fused + fused,
|
|
4817
|
-
ns: timed.ns,
|
|
4818
|
-
hz: hzOf(timed.ns),
|
|
4819
5521
|
merge: 'storage',
|
|
4820
5522
|
holds,
|
|
4821
5523
|
};
|
|
@@ -4823,8 +5525,6 @@ export const qpuPresenceOf = () => {
|
|
|
4823
5525
|
export const qpuPresenceHolds = (p = qpuPresenceOf()) => p.holds === true &&
|
|
4824
5526
|
p.kind === 'presence' &&
|
|
4825
5527
|
p.merge === 'storage' &&
|
|
4826
|
-
p.ns === n - n &&
|
|
4827
|
-
p.hz === hzOf(p.ns) &&
|
|
4828
5528
|
p.users.length === qpuFacesOf().faces &&
|
|
4829
5529
|
p.active + p.inactive === p.faces &&
|
|
4830
5530
|
p.templates.length === n &&
|
|
@@ -5238,6 +5938,14 @@ export const qpuStorageMaintainOf = async (env) => {
|
|
|
5238
5938
|
holds,
|
|
5239
5939
|
};
|
|
5240
5940
|
};
|
|
5941
|
+
/** WRITE AUTH, FAIL CLOSED. Reads stay open. A write is honoured only when QPU_WRITE_TOKEN is bound and the request
|
|
5942
|
+
* carries `Authorization: Bearer <token>`; an unbound token refuses every write. Measured 2026-09-11 by a peer session:
|
|
5943
|
+
* the preflight advertised PUT and DELETE to every origin and the handler honoured them with no check at all. */
|
|
5944
|
+
export const qpuStorageWriteAllowedOf = (env, auth) => {
|
|
5945
|
+
const token = typeof env?.QPU_WRITE_TOKEN === 'string' ? env.QPU_WRITE_TOKEN : '';
|
|
5946
|
+
return token.length > n - n && auth === `Bearer ${token}`;
|
|
5947
|
+
};
|
|
5948
|
+
const storageWriteOf = (method) => method === 'PUT' || method === 'POST' || method === 'DELETE';
|
|
5241
5949
|
export const qpuStorageOf = async (env, input = {}) => {
|
|
5242
5950
|
const meta = qpuStorageMetaOf(env);
|
|
5243
5951
|
const store = storageStoreOf(env);
|
|
@@ -5269,6 +5977,9 @@ export const qpuStorageOf = async (env, input = {}) => {
|
|
|
5269
5977
|
if (key.length === n - n)
|
|
5270
5978
|
return { ...meta, holds: false, denied: 'key' };
|
|
5271
5979
|
const href = `${storageHref}/${key}`;
|
|
5980
|
+
if (storageWriteOf(method) && !qpuStorageWriteAllowedOf(env, input.auth)) {
|
|
5981
|
+
return { ...meta, '@id': href, url: href, key, holds: false, denied: 'auth', auth: 'Bearer QPU_WRITE_TOKEN' };
|
|
5982
|
+
}
|
|
5272
5983
|
if (method === 'DELETE') {
|
|
5273
5984
|
const prior = await store.get(key);
|
|
5274
5985
|
if (isReferrerDoc(prior)) {
|
|
@@ -5413,7 +6124,7 @@ export const qpuStorageHolds = (s = qpuStorageMetaOf()) => s.holds === true &&
|
|
|
5413
6124
|
s.bindings.BLOBS === 'r2' &&
|
|
5414
6125
|
s.href === storageHref &&
|
|
5415
6126
|
jsonldHoldsOf(s);
|
|
5416
|
-
export const qpuStorageToolsOf = (env) => {
|
|
6127
|
+
export const qpuStorageToolsOf = (env, auth) => {
|
|
5417
6128
|
const href = storageHref;
|
|
5418
6129
|
const see = ['storage_catalog', 'storage_list', 'storage_get', 'storage_put', 'storage_del', 'storage_monitor', 'storage_maintain', 'storage_raid'];
|
|
5419
6130
|
const schema = { type: 'object', properties: { man: { type: 'boolean' }, key: { type: 'string' }, value: {} } };
|
|
@@ -5421,7 +6132,7 @@ export const qpuStorageToolsOf = (env) => {
|
|
|
5421
6132
|
{
|
|
5422
6133
|
name: see[n - n],
|
|
5423
6134
|
description: 'Storage catalog. JSON-LD WebAPI. Quantum RAID. All details.',
|
|
5424
|
-
man: qpuSubManOf(see[n - n], 'Storage catalog.', 'Native Alpine Linux. musl. busybox. overlayfs. Inodes. RAID.
|
|
6135
|
+
man: qpuSubManOf(see[n - n], 'Storage catalog.', 'Native Alpine Linux. musl. busybox. overlayfs. Inodes. RAID. Reads no auth. Writes Authorization: Bearer QPU_WRITE_TOKEN; unbound refuses.', href, see.filter((s) => s !== see[n - n])),
|
|
5425
6136
|
inputSchema: schema,
|
|
5426
6137
|
run: () => qpuStorageMcpOf(env)
|
|
5427
6138
|
},
|
|
@@ -5442,16 +6153,16 @@ export const qpuStorageToolsOf = (env) => {
|
|
|
5442
6153
|
{
|
|
5443
6154
|
name: see[n],
|
|
5444
6155
|
description: 'Put a stored value.',
|
|
5445
|
-
man: qpuSubManOf(see[n], 'Put value.', 'Store by content address. Return referrer access link. Inode nlink. Stripe rays. Mirror coins.', href, see.filter((s) => s !== see[n])),
|
|
6156
|
+
man: qpuSubManOf(see[n], 'Put value. Bearer QPU_WRITE_TOKEN.', 'Store by content address. Return referrer access link. Inode nlink. Stripe rays. Mirror coins.', href, see.filter((s) => s !== see[n])),
|
|
5446
6157
|
inputSchema: schema,
|
|
5447
|
-
run: (a) => qpuStorageOf(env, { method: 'PUT', key: a.key, value: a.value })
|
|
6158
|
+
run: (a) => qpuStorageOf(env, { method: 'PUT', key: a.key, value: a.value, auth })
|
|
5448
6159
|
},
|
|
5449
6160
|
{
|
|
5450
6161
|
name: see[n + seed],
|
|
5451
6162
|
description: 'Delete a stored value.',
|
|
5452
|
-
man: qpuSubManOf(see[n + seed], 'Delete link.', 'Unlink. Last link deleted frees the inode.', href, see.filter((s) => s !== see[n + seed])),
|
|
6163
|
+
man: qpuSubManOf(see[n + seed], 'Delete link. Bearer QPU_WRITE_TOKEN.', 'Unlink. Last link deleted frees the inode.', href, see.filter((s) => s !== see[n + seed])),
|
|
5453
6164
|
inputSchema: schema,
|
|
5454
|
-
run: (a) => qpuStorageOf(env, { method: 'DELETE', key: a.key })
|
|
6165
|
+
run: (a) => qpuStorageOf(env, { method: 'DELETE', key: a.key, auth })
|
|
5455
6166
|
},
|
|
5456
6167
|
{
|
|
5457
6168
|
name: see[n + coins],
|
|
@@ -5627,31 +6338,37 @@ const parseGatesOf = (value) => {
|
|
|
5627
6338
|
{ name: 'h', q: n - n },
|
|
5628
6339
|
{ name: 'cnot', c: n - n, t: seed }
|
|
5629
6340
|
];
|
|
5630
|
-
if (
|
|
5631
|
-
return fallback;
|
|
6341
|
+
if (value === undefined)
|
|
6342
|
+
return { ops: fallback, read: 'absent', dropped: n - n };
|
|
6343
|
+
if (!Array.isArray(value))
|
|
6344
|
+
return { ops: fallback, read: 'default', dropped: seed };
|
|
5632
6345
|
const ops = [];
|
|
5633
6346
|
const names = ['h', 'x', 'z', 'cnot', 'cz', 'swap', 'toffoli', 'reset'];
|
|
6347
|
+
let dropped = n - n;
|
|
5634
6348
|
for (const row of value) {
|
|
5635
|
-
|
|
5636
|
-
continue;
|
|
5637
|
-
const name = typeof row.name === 'string' ? row.name : '';
|
|
6349
|
+
const name = row && typeof row === 'object' && !Array.isArray(row) && typeof row.name === 'string' ? row.name : '';
|
|
5638
6350
|
if (names.includes(name))
|
|
5639
6351
|
ops.push(jsonOf(row));
|
|
6352
|
+
else
|
|
6353
|
+
dropped += seed;
|
|
5640
6354
|
}
|
|
5641
|
-
return ops.length > n - n ? ops : fallback;
|
|
6355
|
+
return ops.length > n - n ? { ops, read: 'read', dropped } : { ops: fallback, read: 'default', dropped };
|
|
5642
6356
|
};
|
|
5643
6357
|
export const qpuServerSubmitOf = (input = {}) => {
|
|
5644
6358
|
const computer = qpuComputerOf();
|
|
5645
6359
|
const plugin = qpuPayloadPluginOf();
|
|
5646
6360
|
const payload = qpuPayloadMcpOf();
|
|
5647
|
-
const
|
|
6361
|
+
const parsed = parseGatesOf(input.gates);
|
|
6362
|
+
const ops = parsed.ops;
|
|
5648
6363
|
const measured = measureOf(runGatesOf(ops));
|
|
5649
6364
|
serverSeq += seed;
|
|
5650
|
-
const holds = measured.holds && computer.holds && qpuPayloadPluginHolds(plugin) && payload.holds;
|
|
6365
|
+
const holds = measured.holds && computer.holds && qpuPayloadPluginHolds(plugin) && payload.holds && parsed.read !== 'default';
|
|
5651
6366
|
const job = {
|
|
5652
6367
|
id: serverSeq,
|
|
5653
6368
|
status: 'done',
|
|
5654
6369
|
gates: ops.map((op) => `${op.name ?? ''}`),
|
|
6370
|
+
read: parsed.read,
|
|
6371
|
+
dropped: parsed.dropped,
|
|
5655
6372
|
index: measured.index,
|
|
5656
6373
|
shots: measured.shots,
|
|
5657
6374
|
counts: measured.counts,
|
|
@@ -5660,9 +6377,13 @@ export const qpuServerSubmitOf = (input = {}) => {
|
|
|
5660
6377
|
holds,
|
|
5661
6378
|
};
|
|
5662
6379
|
serverJobs.push(job);
|
|
6380
|
+
/** The run is synchronous and its result is here, in this reply. Nothing is stored: `id` counts jobs in this isolate
|
|
6381
|
+
* only, and a later GET of the job is answered only while this isolate lives. `href` is the server, not the job. */
|
|
5663
6382
|
return {
|
|
5664
6383
|
kind: 'job',
|
|
5665
|
-
href:
|
|
6384
|
+
href: serverHref,
|
|
6385
|
+
stored: false,
|
|
6386
|
+
result: 'inline',
|
|
5666
6387
|
backend: unit.host,
|
|
5667
6388
|
vm: 'browser',
|
|
5668
6389
|
payload: plugin.href,
|
|
@@ -5685,7 +6406,7 @@ export const qpuServerToolsOf = () => {
|
|
|
5685
6406
|
{
|
|
5686
6407
|
name: see[seed],
|
|
5687
6408
|
description: 'Quantum backend.',
|
|
5688
|
-
man: qpuSubManOf(see[seed], 'Backend.', '3-qubit
|
|
6409
|
+
man: qpuSubManOf(see[seed], 'Backend.', '3-qubit register. H CNOT native. H Toffoli universal. Coupling compile.', href, see.filter((s) => s !== see[seed])),
|
|
5689
6410
|
inputSchema: schema,
|
|
5690
6411
|
run: () => {
|
|
5691
6412
|
const computer = qpuComputerOf();
|
|
@@ -5698,9 +6419,9 @@ export const qpuServerToolsOf = () => {
|
|
|
5698
6419
|
basis: computer.basis,
|
|
5699
6420
|
universal: computer.universal,
|
|
5700
6421
|
coupling: computer.coupling,
|
|
5701
|
-
|
|
6422
|
+
register: circuit.register,
|
|
5702
6423
|
vm: 'browser',
|
|
5703
|
-
holds: computer.holds && circuit.
|
|
6424
|
+
holds: computer.holds && circuit.register.holds,
|
|
5704
6425
|
};
|
|
5705
6426
|
}
|
|
5706
6427
|
},
|
|
@@ -5785,7 +6506,7 @@ export const qpuServerMcpOf = () => {
|
|
|
5785
6506
|
basis: computer.basis,
|
|
5786
6507
|
universal: computer.universal,
|
|
5787
6508
|
coupling: computer.coupling,
|
|
5788
|
-
|
|
6509
|
+
register: circuit.register,
|
|
5789
6510
|
vm: 'browser'
|
|
5790
6511
|
},
|
|
5791
6512
|
computer,
|
|
@@ -5894,6 +6615,7 @@ const quantumSlotOf = (name) => {
|
|
|
5894
6615
|
};
|
|
5895
6616
|
const quantumRelatedExtras = [
|
|
5896
6617
|
'only',
|
|
6618
|
+
'planes',
|
|
5897
6619
|
'lattice',
|
|
5898
6620
|
'circuit',
|
|
5899
6621
|
'noise',
|
|
@@ -5902,14 +6624,9 @@ const quantumRelatedExtras = [
|
|
|
5902
6624
|
'sciences',
|
|
5903
6625
|
'drift',
|
|
5904
6626
|
'computer',
|
|
5905
|
-
'cryostat',
|
|
5906
|
-
'telemetry',
|
|
5907
|
-
'millikelvin',
|
|
5908
6627
|
'coil',
|
|
5909
6628
|
'electronics',
|
|
5910
|
-
'resistance',
|
|
5911
6629
|
'speed',
|
|
5912
|
-
'hz',
|
|
5913
6630
|
'hybrid',
|
|
5914
6631
|
'css',
|
|
5915
6632
|
'presence',
|
|
@@ -5928,8 +6645,7 @@ const quantumRelatedOf = () => {
|
|
|
5928
6645
|
kind: circuit.kind,
|
|
5929
6646
|
only: circuit.only,
|
|
5930
6647
|
lattice: circuit.lattice,
|
|
5931
|
-
|
|
5932
|
-
resistance: circuit.fridge.resistance,
|
|
6648
|
+
register: circuit.register,
|
|
5933
6649
|
holds: circuit.holds,
|
|
5934
6650
|
};
|
|
5935
6651
|
doors.noise = circuit.noise;
|
|
@@ -5938,16 +6654,12 @@ const quantumRelatedOf = () => {
|
|
|
5938
6654
|
doors.sciences = circuit.sciences;
|
|
5939
6655
|
doors.drift = circuit.drift;
|
|
5940
6656
|
doors.computer = circuit.computer;
|
|
5941
|
-
doors.
|
|
5942
|
-
doors.
|
|
5943
|
-
doors.millikelvin = circuit.fridge;
|
|
5944
|
-
doors.coil = circuit.fridge.coil;
|
|
5945
|
-
doors.electronics = circuit.fridge.electronics;
|
|
5946
|
-
doors.resistance = circuit.fridge.resistance;
|
|
6657
|
+
doors.coil = circuit.register.coil;
|
|
6658
|
+
doors.electronics = circuit.register.electronics;
|
|
5947
6659
|
doors.speed = speed;
|
|
5948
|
-
doors.hz = speed.hz;
|
|
5949
6660
|
doors.hybrid = qpuHybridOf();
|
|
5950
6661
|
doors.css = qpuCssOf();
|
|
6662
|
+
doors.planes = qpuPlanesOf();
|
|
5951
6663
|
doors.presence = qpuPresenceOf();
|
|
5952
6664
|
doors.kv = qpuHandleOf().kv;
|
|
5953
6665
|
return doors;
|
|
@@ -5961,25 +6673,22 @@ const quantumDoorOf = (name) => {
|
|
|
5961
6673
|
if (name.length === n - n) {
|
|
5962
6674
|
const only = related.only;
|
|
5963
6675
|
const lattice = related.lattice;
|
|
5964
|
-
const
|
|
6676
|
+
const register = related.register;
|
|
5965
6677
|
const speed = related.speed;
|
|
5966
6678
|
const names = Object.keys(related);
|
|
5967
6679
|
return {
|
|
5968
6680
|
kind: 'quantum',
|
|
5969
6681
|
only,
|
|
5970
6682
|
lattice,
|
|
5971
|
-
|
|
5972
|
-
speed: {
|
|
5973
|
-
ns: speed.ns,
|
|
6683
|
+
register,
|
|
6684
|
+
speed: { holds: speed.holds },
|
|
5974
6685
|
related: names,
|
|
5975
|
-
unlocked: only.holds &&
|
|
6686
|
+
unlocked: only.holds && register.holds,
|
|
5976
6687
|
holds: only.holds &&
|
|
5977
6688
|
lattice.holds &&
|
|
5978
6689
|
lattice.vacant === n - n &&
|
|
5979
|
-
|
|
5980
|
-
fridge.resistance === n - n &&
|
|
6690
|
+
register.holds &&
|
|
5981
6691
|
speed.holds &&
|
|
5982
|
-
speed.ns === n - n &&
|
|
5983
6692
|
names.length === lattice.nodes.length + quantumRelatedExtras.length &&
|
|
5984
6693
|
lattice.nodes.every((node) => names.includes(node.name) && related[node.name] !== undefined) &&
|
|
5985
6694
|
quantumRelatedExtras.every((extra) => names.includes(extra) && related[extra] !== undefined)
|
|
@@ -6298,9 +7007,7 @@ export const qpuSandboxOf = () => {
|
|
|
6298
7007
|
quantum.value.only?.holds === true &&
|
|
6299
7008
|
quantum.value.lattice?.holds === true &&
|
|
6300
7009
|
quantum.value.lattice.vacant === n - n &&
|
|
6301
|
-
quantum.value.
|
|
6302
|
-
quantum.value.fridge?.holds === true &&
|
|
6303
|
-
quantum.value.ns === n - n &&
|
|
7010
|
+
quantum.value.register?.holds === true &&
|
|
6304
7011
|
quantum.value.related?.length === related.length &&
|
|
6305
7012
|
quantum.value.holds === true &&
|
|
6306
7013
|
tools.every((t) => qpuManHolds(t.man)) &&
|
|
@@ -6335,7 +7042,7 @@ export const qpuSandboxRunOf = (name, args = {}) => {
|
|
|
6335
7042
|
return { holds: false, denied: 'tool',
|
|
6336
7043
|
unlocked: true };
|
|
6337
7044
|
if (args.man === true)
|
|
6338
|
-
return tool.man;
|
|
7045
|
+
return qpuManPageOf(name, tool.man);
|
|
6339
7046
|
const value = runOpOf(tool.run, sandboxHeap, jsonOf(args), n - n);
|
|
6340
7047
|
return {
|
|
6341
7048
|
kind: 'sandbox',
|
|
@@ -6352,7 +7059,7 @@ export const qpuSandboxRunOf = (name, args = {}) => {
|
|
|
6352
7059
|
export const qpuForgeOf = (args = {}) => {
|
|
6353
7060
|
seedSandboxOf();
|
|
6354
7061
|
if (args.man === true) {
|
|
6355
|
-
return qpuManOf(toolNames[n + seed], 'Agents forge tools in an unlocked in-memory sandbox. Whatever they need.', `Unlocked. All ops and host shims already exist in memory. ${sandboxOps.join(' ')}. Omit name to inspect. { name, run } forges more. No lock.`, `${unit.origin}/mcp`, toolNames.filter((s) => s !== toolNames[n + seed]));
|
|
7062
|
+
return qpuManPageOf(toolNames[n + seed], qpuManOf(toolNames[n + seed], 'Agents forge tools in an unlocked in-memory sandbox. Whatever they need.', `Unlocked. All ops and host shims already exist in memory. ${sandboxOps.join(' ')}. Omit name to inspect. { name, run } forges more. No lock.`, `${unit.origin}/mcp`, toolNames.filter((s) => s !== toolNames[n + seed])));
|
|
6356
7063
|
}
|
|
6357
7064
|
const name = typeof args.name === 'string' ? args.name : '';
|
|
6358
7065
|
if (name.length === n - n)
|
|
@@ -6571,8 +7278,6 @@ export const qpuImproveOf = () => {
|
|
|
6571
7278
|
run.value.only?.holds === true &&
|
|
6572
7279
|
run.value.lattice?.holds === true &&
|
|
6573
7280
|
run.value.lattice.vacant === n - n &&
|
|
6574
|
-
run.value.fridge?.resistance === n - n &&
|
|
6575
|
-
run.value.ns === n - n &&
|
|
6576
7281
|
(run.value.related?.length ?? n - n) === quantumRelatedNamesOf().length &&
|
|
6577
7282
|
run.value.hostEscape === false
|
|
6578
7283
|
};
|
|
@@ -6600,8 +7305,6 @@ export const qpuImproveOf = () => {
|
|
|
6600
7305
|
unlocked.value.only?.holds === true &&
|
|
6601
7306
|
unlocked.value.lattice?.holds === true &&
|
|
6602
7307
|
unlocked.value.lattice.vacant === n - n &&
|
|
6603
|
-
unlocked.value.fridge?.resistance === n - n &&
|
|
6604
|
-
unlocked.value.ns === n - n &&
|
|
6605
7308
|
next === fused + fused
|
|
6606
7309
|
};
|
|
6607
7310
|
const before = {
|
|
@@ -6819,6 +7522,7 @@ export const qpuTrainOf = () => {
|
|
|
6819
7522
|
module: 'agent efficiency',
|
|
6820
7523
|
before: 'next',
|
|
6821
7524
|
dry,
|
|
7525
|
+
steps: qpuStepsOf(),
|
|
6822
7526
|
divide: { teams: coins, agents: faces.rays, challenges: faces.faces },
|
|
6823
7527
|
sandbox: {
|
|
6824
7528
|
kind: sandbox.kind,
|
|
@@ -6853,6 +7557,7 @@ export const qpuTrainOf = () => {
|
|
|
6853
7557
|
};
|
|
6854
7558
|
export const qpuTrainHolds = (t = qpuTrainOf()) => t.holds === true &&
|
|
6855
7559
|
t.kind === 'train' &&
|
|
7560
|
+
qpuStepsHolds(t.steps) &&
|
|
6856
7561
|
t.before === 'next' &&
|
|
6857
7562
|
t.divide.teams === coins &&
|
|
6858
7563
|
t.divide.agents === t.challenges.length / coins &&
|
|
@@ -6890,8 +7595,6 @@ export const qpuCompeteOf = (team) => {
|
|
|
6890
7595
|
unlocked.value.only?.holds === true &&
|
|
6891
7596
|
unlocked.value.lattice?.holds === true &&
|
|
6892
7597
|
unlocked.value.lattice.vacant === n - n &&
|
|
6893
|
-
unlocked.value.fridge?.resistance === n - n &&
|
|
6894
|
-
unlocked.value.ns === n - n &&
|
|
6895
7598
|
next === fused + fused
|
|
6896
7599
|
};
|
|
6897
7600
|
const agentsOf = (path, throughoutput) => efficiency.rows.map((r) => {
|
|
@@ -6953,14 +7656,17 @@ export const qpuProveOf = () => {
|
|
|
6953
7656
|
const cern = qpuCernOf();
|
|
6954
7657
|
const integrity = qpuIntegrityOf();
|
|
6955
7658
|
const circuit = qpuCircuitOf();
|
|
7659
|
+
const ledgerFrom = qpuReceiptLedgerOf().length;
|
|
6956
7660
|
const shor = qpuShorOf();
|
|
7661
|
+
const receipts = qpuShorReceiptsOf(ledgerFrom);
|
|
7662
|
+
const encrypt = qpuEncryptOf();
|
|
6957
7663
|
const intelligence = qpuIntelligenceOf();
|
|
6958
7664
|
const neuro = qpuNeuroOf();
|
|
6959
7665
|
const coil = qpuCoilOf();
|
|
6960
7666
|
const next = qpuNextOf();
|
|
6961
7667
|
const sequence = qpuSequenceOf();
|
|
6962
7668
|
const purpose = qpuPurposeOf(circuit, shor, sequence, qpuCapacityOf());
|
|
6963
|
-
const evidence = qpuEvidenceOf(circuit, shor
|
|
7669
|
+
const evidence = qpuEvidenceOf(circuit, shor);
|
|
6964
7670
|
const theorems = [...lean.rows, ...lean.cover, lean.climb];
|
|
6965
7671
|
const ui = {
|
|
6966
7672
|
href: unit.origin,
|
|
@@ -6992,6 +7698,7 @@ export const qpuProveOf = () => {
|
|
|
6992
7698
|
circuit.holds &&
|
|
6993
7699
|
circuit.hardware.holds &&
|
|
6994
7700
|
qpuShorHolds(shor) &&
|
|
7701
|
+
qpuEncryptHolds(encrypt) &&
|
|
6995
7702
|
purpose.holds &&
|
|
6996
7703
|
evidence.holds &&
|
|
6997
7704
|
shor.factors.p * shor.factors.q === shor.n &&
|
|
@@ -7042,8 +7749,12 @@ export const qpuProveOf = () => {
|
|
|
7042
7749
|
period: shor.post.period,
|
|
7043
7750
|
factors: [shor.factors.p, shor.factors.q],
|
|
7044
7751
|
product: shor.factors.product,
|
|
7752
|
+
rsa: shor.rsa,
|
|
7753
|
+
unlocked: shor.unlocked,
|
|
7754
|
+
lock: shor.lock,
|
|
7045
7755
|
holds: shor.holds,
|
|
7046
7756
|
},
|
|
7757
|
+
encrypt,
|
|
7047
7758
|
coil: {
|
|
7048
7759
|
theorem: coil.theorem,
|
|
7049
7760
|
windings: coil.windings,
|
|
@@ -7062,6 +7773,9 @@ export const qpuProveOf = () => {
|
|
|
7062
7773
|
holds: next.holds,
|
|
7063
7774
|
},
|
|
7064
7775
|
src: lean.src,
|
|
7776
|
+
source: lean.source,
|
|
7777
|
+
receipts,
|
|
7778
|
+
glossary: qpuGlossaryOf(),
|
|
7065
7779
|
lean,
|
|
7066
7780
|
theorems,
|
|
7067
7781
|
cern,
|
|
@@ -7081,7 +7795,7 @@ export const qpuProveHolds = (p = qpuProveOf()) => p.holds === true &&
|
|
|
7081
7795
|
p.lattice.occupied === p.lattice.faces &&
|
|
7082
7796
|
p.lattice.vacant === n - n &&
|
|
7083
7797
|
p.circuit.hardware.holds === true &&
|
|
7084
|
-
p.circuit.hardware.device === '
|
|
7798
|
+
p.circuit.hardware.device === 'simulator' &&
|
|
7085
7799
|
p.circuit.hardware.initialize === true &&
|
|
7086
7800
|
p.circuit.hardware.gates === true &&
|
|
7087
7801
|
p.circuit.hardware.interfere === true &&
|
|
@@ -7091,8 +7805,9 @@ export const qpuProveHolds = (p = qpuProveOf()) => p.holds === true &&
|
|
|
7091
7805
|
p.circuit.hardware.path.submit === `${unit.origin}/server` &&
|
|
7092
7806
|
p.circuit.holds === true &&
|
|
7093
7807
|
p.shor.holds === true &&
|
|
7094
|
-
p.shor.n ===
|
|
7095
|
-
p.shor.a === mintOf(n)
|
|
7808
|
+
p.shor.n === qpuFacesOf().rays * (n * n + n + seed) &&
|
|
7809
|
+
p.shor.a === mintOf(n) &&
|
|
7810
|
+
p.shor.unlocked === true &&
|
|
7096
7811
|
p.shor.coprime === true &&
|
|
7097
7812
|
p.shor.circuitry === 'cmodexp' &&
|
|
7098
7813
|
p.shor.qft === 'iqft' &&
|
|
@@ -7100,6 +7815,12 @@ export const qpuProveHolds = (p = qpuProveOf()) => p.holds === true &&
|
|
|
7100
7815
|
p.shor.noise === 'xx' &&
|
|
7101
7816
|
p.shor.factors[n - n] * p.shor.factors[seed] === p.shor.n &&
|
|
7102
7817
|
p.shor.product === p.shor.n &&
|
|
7818
|
+
p.shor.rsa.kind === 'rsa' &&
|
|
7819
|
+
p.shor.rsa.modulus === p.shor.n &&
|
|
7820
|
+
p.shor.rsa.factored === true &&
|
|
7821
|
+
qpuEncryptHolds(p.encrypt) &&
|
|
7822
|
+
p.encrypt.theorem === 'crypto' &&
|
|
7823
|
+
p.encrypt.identity === true &&
|
|
7103
7824
|
qpuPurposeHolds(p.purpose) &&
|
|
7104
7825
|
p.purpose.cybersecurity.product === p.shor.n &&
|
|
7105
7826
|
p.purpose.nature.platform === p.circuit.hardware.device &&
|
|
@@ -7125,6 +7846,11 @@ export const qpuProveHolds = (p = qpuProveOf()) => p.holds === true &&
|
|
|
7125
7846
|
p.next.nextCoil === p.next.nextFused &&
|
|
7126
7847
|
qpuNextHolds() &&
|
|
7127
7848
|
p.src === unit.fuse.lean &&
|
|
7849
|
+
p.source.holds === true &&
|
|
7850
|
+
p.source.fold === qpuFoldOf(leanSource) &&
|
|
7851
|
+
p.source.verbatim === p.source.served &&
|
|
7852
|
+
p.receipts.holds === true &&
|
|
7853
|
+
p.receipts.fold === qpuReceiptFoldOf(p.receipts.rows) &&
|
|
7128
7854
|
qpuLeanHolds(p.lean) &&
|
|
7129
7855
|
qpuCernHolds(p.cern) &&
|
|
7130
7856
|
qpuIntegrityHolds(p.integrity) &&
|
|
@@ -7730,6 +8456,12 @@ export const qpuCssOf = (imagine = '', genesis = qpuGenesisOf()) => {
|
|
|
7730
8456
|
const none = n - n;
|
|
7731
8457
|
const seated = imagine.length > none ? faceOf(imagine, faces.faces) : none;
|
|
7732
8458
|
const hop = (seated + faces.rays + faces.rays) % faces.faces;
|
|
8459
|
+
/** LATTICE PHASE (the captain, 2026-09-12: "re-fuse all animations to follow the quantum lattice"). Every face keeps
|
|
8460
|
+
* the one fused keyframe, but its phase is its position on the genesis walk (0, 7, 1, 8, … 6, 13): ray 0's scanner
|
|
8461
|
+
* face, its radar face by the hop, the next ray. One negative animation-delay rule reads `--walk`, and the timing
|
|
8462
|
+
* function steps once per face, so the grid is the walk itself, not fourteen faces pulsing in line. */
|
|
8463
|
+
const walkOf = (face) => (face % faces.rays) * coins + (face < faces.rays ? none : seed);
|
|
8464
|
+
const walk = qpuStepsOf().walk.map((step) => step.face);
|
|
7733
8465
|
const physicsOf = (name) => {
|
|
7734
8466
|
if (name === 'split')
|
|
7735
8467
|
return { x: none, y: none, r: none, s: coins, a: seed };
|
|
@@ -7757,7 +8489,7 @@ export const qpuCssOf = (imagine = '', genesis = qpuGenesisOf()) => {
|
|
|
7757
8489
|
return { x: coins, y: none, r: none, s: seed, a: seed };
|
|
7758
8490
|
if (name === 'measurement')
|
|
7759
8491
|
return { x: none, y: none, r: none, s: seed, a: seed };
|
|
7760
|
-
if (name === '
|
|
8492
|
+
if (name === 'register')
|
|
7761
8493
|
return { x: none, y: ten, r: none, s: seed, a: seed };
|
|
7762
8494
|
return { x: none, y: none, r: none, s: seed, a: seed };
|
|
7763
8495
|
};
|
|
@@ -7794,11 +8526,11 @@ export const qpuCssOf = (imagine = '', genesis = qpuGenesisOf()) => {
|
|
|
7794
8526
|
`@property --qpu-a{syntax:"<number>";inherits:false;initial-value:${seed}}` +
|
|
7795
8527
|
`:root{--qpu-hz:${hz};--qpu-n:${n};--qpu-coins:${coins};--qpu-rays:${faces.rays};--qpu-faces:${faces.faces};--qpu-milli:${milli};--qpu-period:calc(1s * var(--qpu-milli) / var(--qpu-hz))}` +
|
|
7796
8528
|
`.qpu{display:grid;grid-template-columns:repeat(var(--qpu-rays),minmax(0,1fr))}` +
|
|
7797
|
-
`.qpu>*{aspect-ratio:${seed};color:hsl(calc(var(--qpu-hz) * var(--face,${none}) / var(--qpu-faces)) ${sat}% ${light}%);animation:qpu var(--qpu-period)
|
|
8529
|
+
`.qpu>*{aspect-ratio:${seed};color:hsl(calc(var(--qpu-hz) * var(--face,${none}) / var(--qpu-faces)) ${sat}% ${light}%);animation:qpu var(--qpu-period) steps(var(--qpu-faces),jump-none) infinite;animation-delay:calc(${none - seed} * var(--qpu-period) * var(--walk,${none}) / var(--qpu-faces));will-change:transform,opacity}` +
|
|
7798
8530
|
`.qpu>*::after{content:attr(data-qpu)}` +
|
|
7799
8531
|
`.qpu>[data-imagine]{--qpu-s:${coins}}` +
|
|
7800
8532
|
genesis.card.map((slot) => `[data-slot=${slot}]{display:grid}`).join('') +
|
|
7801
|
-
genesis.nodes.map((node) => `[data-framework=${node.name}][data-domain=${node.domain}]{--face:${node.face}}`).join('') +
|
|
8533
|
+
genesis.nodes.map((node) => `[data-framework=${node.name}][data-domain=${node.domain}]{--face:${node.face};--walk:${walkOf(node.face)}}`).join('') +
|
|
7802
8534
|
`[data-slot=card-header]:has([data-slot=card-action]){grid-template-columns:minmax(0,1fr) auto}` +
|
|
7803
8535
|
`@keyframes qpu{${mid}%{transform:translate3d(var(--qpu-x),var(--qpu-y),0) rotate(var(--qpu-r)) scale(var(--qpu-s));opacity:var(--qpu-a)}}` +
|
|
7804
8536
|
`@media (prefers-reduced-motion:reduce){.qpu>*{animation:none;will-change:auto}}` +
|
|
@@ -7832,7 +8564,13 @@ export const qpuCssOf = (imagine = '', genesis = qpuGenesisOf()) => {
|
|
|
7832
8564
|
engine.includes('data-domain=radar') &&
|
|
7833
8565
|
genesis.frameworks.every((name) => engine.includes(`data-framework=${name}`)) &&
|
|
7834
8566
|
engine.includes(`--qpu-hz:${hz}`) &&
|
|
7835
|
-
engine.
|
|
8567
|
+
engine.split('animation-delay').length === coins &&
|
|
8568
|
+
engine.includes('--walk') &&
|
|
8569
|
+
engine.includes('linear') === false &&
|
|
8570
|
+
walk.length === faces.faces &&
|
|
8571
|
+
new Set(walk).size === faces.faces &&
|
|
8572
|
+
walk.every((face, at) => walkOf(face) === at) &&
|
|
8573
|
+
genesis.nodes.every((node) => walkOf(node.face) < faces.faces) &&
|
|
7836
8574
|
hz === 432 &&
|
|
7837
8575
|
hop === seated &&
|
|
7838
8576
|
experiments.every((row) => row.holds);
|
|
@@ -7848,6 +8586,7 @@ export const qpuCssOf = (imagine = '', genesis = qpuGenesisOf()) => {
|
|
|
7848
8586
|
fused: { bytes: fusedBytes, keyframes, cover },
|
|
7849
8587
|
naive: { bytes: naiveBytes, keyframes: cover, cover },
|
|
7850
8588
|
winner: 'fused',
|
|
8589
|
+
lattice: { walk, phase: '--walk', ticks: faces.faces },
|
|
7851
8590
|
imagine: {
|
|
7852
8591
|
kind: 'imagination',
|
|
7853
8592
|
text: imagine,
|
|
@@ -7868,7 +8607,10 @@ export const qpuCssHolds = (c = qpuCssOf()) => c.holds === true &&
|
|
|
7868
8607
|
c.slots[n + seed] === 'card-action' &&
|
|
7869
8608
|
c.css.includes('data-domain=scanner') &&
|
|
7870
8609
|
c.css.includes('data-domain=radar') &&
|
|
7871
|
-
c.css.
|
|
8610
|
+
c.css.split('animation-delay').length === coins &&
|
|
8611
|
+
c.css.includes('--walk') &&
|
|
8612
|
+
c.css.includes('linear') === false &&
|
|
8613
|
+
c.lattice.walk.length === c.lattice.ticks &&
|
|
7872
8614
|
c.imagine.involution === true;
|
|
7873
8615
|
export const qpuReflectOf = (imagine = '') => {
|
|
7874
8616
|
const text = typeof imagine === 'string' ? imagine : '';
|
|
@@ -8076,7 +8818,7 @@ export const qpuCompeteLiveOf = async (team) => {
|
|
|
8076
8818
|
holds,
|
|
8077
8819
|
};
|
|
8078
8820
|
};
|
|
8079
|
-
|
|
8821
|
+
const qpuProveLiveOf = async () => {
|
|
8080
8822
|
const prove = qpuProveOf();
|
|
8081
8823
|
const live = await qpuCernExperienceOf();
|
|
8082
8824
|
const holds = prove.holds &&
|
|
@@ -8094,7 +8836,7 @@ export const qpuProveLiveOf = async () => {
|
|
|
8094
8836
|
holds,
|
|
8095
8837
|
};
|
|
8096
8838
|
};
|
|
8097
|
-
|
|
8839
|
+
const qpuSequenceLiveOf = async () => {
|
|
8098
8840
|
const train = await qpuTrainLiveOf();
|
|
8099
8841
|
const improve = await qpuImproveLiveOf();
|
|
8100
8842
|
const compete = await qpuCompeteLiveOf();
|
|
@@ -8258,15 +9000,47 @@ export const qpuHostsHolds = (h = qpuHostsOf()) => h.holds === true &&
|
|
|
8258
9000
|
h.occupied === h.faces &&
|
|
8259
9001
|
h.vacant === n - n &&
|
|
8260
9002
|
h.nodes.every((node) => node.holds && node.involution);
|
|
8261
|
-
|
|
9003
|
+
/** initialize NEGOTIATES (MCP lifecycle): the reply carries the client's requested protocol version when this server
|
|
9004
|
+
* supports it, else the latest it supports. An external audit (2026-09-12) found the old reply always said 2026-07-28,
|
|
9005
|
+
* a version no client has ever sent — a typed number where a read one belongs. The three versions are the three
|
|
9006
|
+
* published MCP revisions; the list is theirs, not ours. */
|
|
9007
|
+
/** INTEGRATE IN ANY HARNESS (the captain, 2026-09-12). One computed block, from the origin alone, served on initialize
|
|
9008
|
+
* and printed in the README from the same function, so the wire and the paper cannot disagree. Shapes verified against
|
|
9009
|
+
* each harness's own documentation on 2026-09-12: Claude Code (`claude mcp add --transport http`, or .mcp.json for a
|
|
9010
|
+
* project), Cursor (.cursor/mcp.json mcpServers.url), VS Code (.vscode/mcp.json servers type http), OpenAI Codex CLI
|
|
9011
|
+
* (config.toml [mcp_servers.<name>] url), Gemini CLI (settings.json mcpServers.httpUrl), the Anthropic Messages API
|
|
9012
|
+
* (mcp_servers with the beta header), the OpenAI Responses API (a tools entry of type mcp), and bare JSON-RPC over
|
|
9013
|
+
* HTTP for everything else. No auth: reads need no header; storage writes carry Authorization: Bearer. */
|
|
9014
|
+
export const qpuHarnessesOf = () => {
|
|
9015
|
+
const url = `${unit.origin}/mcp`;
|
|
9016
|
+
const name = `uuidna-${unit.kind}`;
|
|
9017
|
+
const rows = [
|
|
9018
|
+
{ harness: 'Claude Code', kind: 'cli', how: `claude mcp add --transport http ${name} ${url}`, file: '.mcp.json', config: { mcpServers: { [name]: { type: 'http', url } } } },
|
|
9019
|
+
{ harness: 'Cursor', kind: 'file', how: 'add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)', file: '.cursor/mcp.json', config: { mcpServers: { [name]: { url } } } },
|
|
9020
|
+
{ harness: 'VS Code', kind: 'file', how: 'add to .vscode/mcp.json and commit it', file: '.vscode/mcp.json', config: { servers: { [name]: { type: 'http', url } } } },
|
|
9021
|
+
{ harness: 'OpenAI Codex CLI', kind: 'cli', how: `codex mcp add ${name} --url ${url}`, file: '~/.codex/config.toml', config: `[mcp_servers.${name}]\nurl = "${url}"` },
|
|
9022
|
+
{ harness: 'Gemini CLI', kind: 'file', how: 'add to ~/.gemini/settings.json', file: '~/.gemini/settings.json', config: { mcpServers: { [name]: { httpUrl: url } } } },
|
|
9023
|
+
{ harness: 'Anthropic Messages API', kind: 'api', how: 'header anthropic-beta: mcp-client-2025-04-04', file: 'request body', config: { mcp_servers: [{ type: 'url', url, name }] } },
|
|
9024
|
+
{ harness: 'OpenAI Responses API', kind: 'api', how: 'a tools entry of type mcp', file: 'request body', config: { tools: [{ type: 'mcp', server_label: name, server_url: url, require_approval: 'never' }] } },
|
|
9025
|
+
{ harness: 'Any HTTP client', kind: 'raw', how: `POST ${url} with content-type: application/json; methods initialize, tools/list, tools/call`, file: 'none', config: { jsonrpc: '2.0', id: 1, method: 'tools/list' } },
|
|
9026
|
+
];
|
|
9027
|
+
const holds = rows.length === mintOf(n) && rows.every((r) => JSON.stringify(r.config).includes(url) || r.how.includes(url)) && rows.every((r) => JSON.stringify(r).includes(name) || r.kind === 'raw');
|
|
9028
|
+
return { kind: 'harnesses', url, name, auth: 'none for reads; Authorization: Bearer QPU_WRITE_TOKEN for storage writes', rows, holds };
|
|
9029
|
+
};
|
|
9030
|
+
export const qpuHarnessesHolds = (h = qpuHarnessesOf()) => h.holds === true && h.rows.length === mintOf(n) && h.url === `${unit.origin}/mcp`;
|
|
9031
|
+
export const MCP_VERSIONS = ['2024-11-05', '2025-03-26', '2025-06-18'];
|
|
9032
|
+
const qpuMcpVersionOf = (requested) => MCP_VERSIONS.includes(String(requested)) ? requested : MCP_VERSIONS[n - seed];
|
|
9033
|
+
export const qpuMcpDiscoverOf = (requested) => {
|
|
8262
9034
|
const hosts = qpuHostsOf();
|
|
8263
|
-
const versions =
|
|
8264
|
-
const
|
|
9035
|
+
const versions = MCP_VERSIONS;
|
|
9036
|
+
const instructions = `tools/list then tools/call. Sixteen tools: Eight doors. Eight cybersecurity. crypto_rsa ${shorFactorOf()}. crypto_split theorem crypto. No auth.`;
|
|
9037
|
+
const holds = qpuHostsHolds(hosts) && versions.length === n && instructions.includes('crypto_rsa') && instructions.includes(`${shorFactorOf()}`) && instructions.includes('crypto_split') && instructions.includes('theorem crypto');
|
|
8265
9038
|
return {
|
|
8266
|
-
protocolVersion:
|
|
9039
|
+
protocolVersion: qpuMcpVersionOf(requested),
|
|
9040
|
+
install: qpuHarnessesOf(),
|
|
8267
9041
|
capabilities: { tools: { listChanged: false } },
|
|
8268
9042
|
serverInfo: { name: `@uuidna/${unit.kind}`, title: 'QPU', version: 'quantum' },
|
|
8269
|
-
instructions
|
|
9043
|
+
instructions,
|
|
8270
9044
|
versions,
|
|
8271
9045
|
hosts: { harnesses: hosts.harnesses.length, llms: hosts.llms.length, holds: hosts.holds },
|
|
8272
9046
|
holds,
|
|
@@ -8315,6 +9089,243 @@ const installSelectOf = (args) => {
|
|
|
8315
9089
|
}
|
|
8316
9090
|
return [];
|
|
8317
9091
|
};
|
|
9092
|
+
/** THE PRIOR ART, SOURCED (audited 2026-09-12 against the repository itself, not from memory). QPULib is Matthew
|
|
9093
|
+
* Naylor's C++ language and compiler for the VideoCore QPUs, MIT-licensed, and its own README calls it experimental
|
|
9094
|
+
* and no longer under development. Its getting-started guide names the three ways one kernel runs — the source
|
|
9095
|
+
* language interpreter, the target language emulator, and the Pi's physical QPUs, chosen by passing QPU=1 to make —
|
|
9096
|
+
* and its AutoTest runs each test on the interpreter AND the emulator and checks the two agree. That equivalence
|
|
9097
|
+
* check is this unit's own law with the seat empty: the exact integer simulator is the reference, and an occupant
|
|
9098
|
+
* that disagrees with it is a driver bug. Credited here because the acronym was theirs first. The earlier credit in
|
|
9099
|
+
* this file carried a surname and a year with no source; every field below was read from the repository. */
|
|
9100
|
+
export const qpuPriorArtOf = () => ({
|
|
9101
|
+
kind: 'prior-art',
|
|
9102
|
+
name: 'QPULib',
|
|
9103
|
+
author: 'Matthew Naylor',
|
|
9104
|
+
year: 2016,
|
|
9105
|
+
licence: 'MIT',
|
|
9106
|
+
copyright: 'Copyright (c) 2016 Matthew Naylor',
|
|
9107
|
+
repository: 'https://github.com/mn416/QPULib',
|
|
9108
|
+
version: '0.1.0',
|
|
9109
|
+
status: 'experimental, no longer under development — stated by its own README',
|
|
9110
|
+
acronym: 'QPU there is Broadcom VideoCore Quad Processing Unit, a classical SIMD vector core, unrelated to this unit',
|
|
9111
|
+
hardware: { qpus: 12, megahertz: 250, lanes: 16, bits: 32, cyclesPerVector: 4 },
|
|
9112
|
+
modes: [
|
|
9113
|
+
{ name: 'source language interpreter', runs: 'any machine', purpose: 'the kernel read at source level' },
|
|
9114
|
+
{ name: 'target language emulator', runs: 'any machine', purpose: 'the generated target program, for debugging' },
|
|
9115
|
+
{ name: 'physical QPUs', runs: 'Raspberry Pi', purpose: 'the device itself, chosen by passing QPU=1 to make' },
|
|
9116
|
+
],
|
|
9117
|
+
equivalence: 'AutoTest runs each test on both the interpreter and the emulator and checks they agree',
|
|
9118
|
+
inherited: 'one kernel, several ways to run it, and a reference that decides which one is wrong',
|
|
9119
|
+
holds: true,
|
|
9120
|
+
});
|
|
9121
|
+
/** value + predicate (the dryclean law): the sourced credit recomputes to itself and can never lose its source */
|
|
9122
|
+
export const qpuPriorArtHolds = (p = qpuPriorArtOf()) => p.author === 'Matthew Naylor' && p.year === 2016 && p.licence === 'MIT' &&
|
|
9123
|
+
p.copyright.includes(String(p.year)) && p.copyright.includes(p.author) &&
|
|
9124
|
+
p.repository.startsWith('https://github.com/') && p.modes.length === 3 &&
|
|
9125
|
+
p.modes.some((m) => m.name === 'source language interpreter') &&
|
|
9126
|
+
p.modes.some((m) => m.name === 'target language emulator') &&
|
|
9127
|
+
p.modes.some((m) => m.purpose.includes('QPU=1')) &&
|
|
9128
|
+
p.hardware.lanes === 16 && p.hardware.qpus === 12 && p.hardware.bits === 32;
|
|
9129
|
+
/** THE UNIT AS A ROUTER OF REFERRERS (the captain, 2026-09-13: "QPU is basically intelligent router of referrers",
|
|
9130
|
+
* "intelligence decides lean where processes is computed in realtime"). A request arrives with a referrer and a path;
|
|
9131
|
+
* this decides, per request, which door answers and on which SEAT the work is computed. The three seats are the shape
|
|
9132
|
+
* audited from QPULib's three ways to run one kernel: the REFERENCE (the exact integer simulator, always present and
|
|
9133
|
+
* always deciding), a VECTOR seat (a SIMD or GPU binding, taken only when the runtime actually exposes one), and the
|
|
9134
|
+
* DEVICE seat (empty). Availability is READ from the runtime at the moment of the call, never asserted: measured
|
|
9135
|
+
* 2026-09-13 on an Apple M1 Max carrying 32 GPU cores, no compute binding was reachable from this runtime at all, so
|
|
9136
|
+
* the vector seat reports itself absent and the reference answers. A seat that is taken and then disagrees with the
|
|
9137
|
+
* reference is a driver bug, never a physics claim — QPULib checks its interpreter against its emulator the same way. */
|
|
9138
|
+
export const qpuSeatsAvailableOf = () => {
|
|
9139
|
+
const nav = globalThis.navigator;
|
|
9140
|
+
return {
|
|
9141
|
+
reference: true,
|
|
9142
|
+
vector: typeof nav?.gpu === 'object' && nav.gpu !== null,
|
|
9143
|
+
device: false,
|
|
9144
|
+
};
|
|
9145
|
+
};
|
|
9146
|
+
/** value + predicate (the dryclean law): the seats reading recomputes to itself, and the reference is never absent */
|
|
9147
|
+
export const qpuSeatsAvailableHolds = (a = qpuSeatsAvailableOf()) => a.reference === true && a.device === false && typeof a.vector === 'boolean' &&
|
|
9148
|
+
a.vector === qpuSeatsAvailableOf().vector;
|
|
9149
|
+
/** THE SEAT WAS FILLED AND CHECKED (2026-09-13). A WebGPU occupant computed this unit's own fold over N independent
|
|
9150
|
+
* strings, one per invocation, with the 64-bit multiply emulated in 32-bit halves, and every result was compared with
|
|
9151
|
+
* the reference. It agreed exactly at both sizes below. Past the device's storage binding limit the dispatch is
|
|
9152
|
+
* REFUSED and the output buffer stays zero — where a naive timing read 67x faster, because it was comparing against
|
|
9153
|
+
* nothing. So the law this unit already held is now measured, not asserted: a seat's answer is void until the
|
|
9154
|
+
* reference confirms it. Reproduce with scripts/fold-gpu.ts on a runtime that exposes WebGPU. */
|
|
9155
|
+
export const qpuOccupantOf = () => ({
|
|
9156
|
+
kind: 'occupant',
|
|
9157
|
+
seat: 'vector',
|
|
9158
|
+
binding: 'WebGPU compute, WGSL, 64-bit multiply emulated in 32-bit halves',
|
|
9159
|
+
host: 'Apple M1 Max, 32 GPU cores',
|
|
9160
|
+
runtime: 'Deno 2.8.1; this unit\'s own runtime exposes no compute binding, so it answers on the reference',
|
|
9161
|
+
readings: [
|
|
9162
|
+
{ folds: 70905, exact: 70905, mismatched: 0, gpuMs: 50.3, cpuMs: 116.9 },
|
|
9163
|
+
{ folds: 300000, exact: 300000, mismatched: 0, gpuMs: 75.0, cpuMs: 470.5 },
|
|
9164
|
+
],
|
|
9165
|
+
refused: { folds: 709050, why: 'the chars binding asked 212.7 MiB of a 128 MiB limit', returned: 'zeros', naiveRatio: 67.53 },
|
|
9166
|
+
cured: { by: 'chunking every binding under the device limit', readings: [
|
|
9167
|
+
{ folds: 709050, chunks: 2, exact: 709050, mismatched: 0, gpuMs: 201.2, cpuMs: 1110.4 },
|
|
9168
|
+
{ folds: 1418100, chunks: 4, exact: 1418100, mismatched: 0, gpuMs: 453.5, cpuMs: 2286.6 },
|
|
9169
|
+
] },
|
|
9170
|
+
law: 'a seat that is taken answers nothing until the reference confirms it; a refused dispatch returns zeros and times as a triumph',
|
|
9171
|
+
script: 'scripts/fold-gpu.ts',
|
|
9172
|
+
holds: true,
|
|
9173
|
+
});
|
|
9174
|
+
/** value + predicate (the dryclean law): every reading agreed exactly, and the refused one is recorded as refused */
|
|
9175
|
+
export const qpuOccupantHolds = (o = qpuOccupantOf()) => o.readings.length > 0 && o.readings.every((r) => r.exact === r.folds && r.mismatched === 0 && r.gpuMs > 0 && r.cpuMs > 0) &&
|
|
9176
|
+
o.refused.returned === 'zeros' && o.refused.naiveRatio > 1 && o.law.includes('reference') &&
|
|
9177
|
+
o.cured.readings.length > 0 && o.cured.readings.every((r) => r.exact === r.folds && r.mismatched === 0 && r.chunks > 1) &&
|
|
9178
|
+
o.cured.readings.some((r) => r.folds === o.refused.folds);
|
|
9179
|
+
export const qpuRouterOf = (referrer = '', path = '/') => {
|
|
9180
|
+
const seats = qpuSeatsAvailableOf();
|
|
9181
|
+
const doors = qpuDocsOf().api.map((a) => a.path);
|
|
9182
|
+
const known = doors.includes(path);
|
|
9183
|
+
const from = (() => {
|
|
9184
|
+
try {
|
|
9185
|
+
return new URL(referrer).host;
|
|
9186
|
+
}
|
|
9187
|
+
catch {
|
|
9188
|
+
return '';
|
|
9189
|
+
}
|
|
9190
|
+
})();
|
|
9191
|
+
const seat = seats.vector ? 'vector' : 'reference';
|
|
9192
|
+
return {
|
|
9193
|
+
kind: 'router',
|
|
9194
|
+
referrer: from,
|
|
9195
|
+
origin: from === unit.host ? 'self' : from ? 'foreign' : 'none',
|
|
9196
|
+
path,
|
|
9197
|
+
door: known ? path : '/',
|
|
9198
|
+
known,
|
|
9199
|
+
seat,
|
|
9200
|
+
seats,
|
|
9201
|
+
decidedAt: 'request',
|
|
9202
|
+
reference: 'the exact integer simulator; it computes the answer the taken seat must reproduce',
|
|
9203
|
+
why: seats.vector
|
|
9204
|
+
? 'a vector binding is exposed by this runtime, so the work may ride it and is checked against the reference'
|
|
9205
|
+
: 'no compute binding is exposed by this runtime, so the reference computes and nothing is claimed of a device',
|
|
9206
|
+
holds: true,
|
|
9207
|
+
};
|
|
9208
|
+
};
|
|
9209
|
+
/** value + predicate (the dryclean law): the routing decision recomputes to itself and never routes off the doors */
|
|
9210
|
+
export const qpuRouterHolds = (r = qpuRouterOf()) => r.seats.reference === true && r.seats.device === false &&
|
|
9211
|
+
(r.seat === 'reference' || r.seat === 'vector') &&
|
|
9212
|
+
(r.seat === 'vector') === r.seats.vector &&
|
|
9213
|
+
qpuDocsOf().api.map((a) => a.path).includes(r.door) &&
|
|
9214
|
+
(r.known ? r.door === r.path : r.door === '/') &&
|
|
9215
|
+
(r.origin === 'none') === (r.referrer === '');
|
|
9216
|
+
// ── THE SEAT, THE ACRONYM, THE BOOT (the captain, 2026-09-12: "make hardware bootable with qpu") ────────────────
|
|
9217
|
+
// QPULib (Naylor, 2016) runs one kernel three ways — source interpreter, target emulator, VideoCore hardware — and
|
|
9218
|
+
// states the doctrine: a program that works in emulation but not on the device is a bug in the library. This unit has
|
|
9219
|
+
// the same shape with the seat empty: the exact integer simulator is the reference; a device that fills the seat and
|
|
9220
|
+
// disagrees is a driver bug, never a physics claim. "QPU" there is Broadcom's Quad Processing Unit — a classical 16-lane
|
|
9221
|
+
// SIMD vector core — prior use of this acronym, unrelated, and credited. A classical accelerator computing the same 2^n
|
|
9222
|
+
// exact amplitudes faster is an honest occupant of the seat; it would not make the seat quantum.
|
|
9223
|
+
const qpuSeatOf = () => ({
|
|
9224
|
+
kind: 'seat',
|
|
9225
|
+
device: 'simulator',
|
|
9226
|
+
seat: 'empty',
|
|
9227
|
+
reference: 'the exact integer state-vector simulator; every reading above is computed there',
|
|
9228
|
+
doctrine: 'a device that fills this seat and disagrees with the simulator is a driver bug, never a physics claim',
|
|
9229
|
+
acronym: 'QPU here is a quantum processing unit. The VideoCore QPU (Quad Processing Unit, Broadcom; QPULib by Matthew Naylor, MIT, 2016) is prior use of the acronym — a classical 16-lane SIMD vector core — unrelated and credited.',
|
|
9230
|
+
occupant: 'a classical SIMD accelerator computing the same exact amplitudes faster is an honest occupant; it does not make the seat quantum',
|
|
9231
|
+
priorArt: qpuPriorArtOf(),
|
|
9232
|
+
holds: true,
|
|
9233
|
+
});
|
|
9234
|
+
/** install.json, served and written from one function so the host and the file cannot disagree (the README promised
|
|
9235
|
+
* install.json and the host answered 404 until 2026-09-12). `hardware` is the boot on a real machine: any aarch64 or x86
|
|
9236
|
+
* box, a Raspberry Pi on Alpine, or the container — and the boot's receipt is the unit proving itself inside it. */
|
|
9237
|
+
export const qpuInstallJsonOf = () => qpuInstallManifestOf();
|
|
9238
|
+
/** value + predicate (the dryclean law): the served install reading recomputes to itself */
|
|
9239
|
+
export const qpuInstallJsonHolds = () => qpuInstallManifestOf().holds === true && qpuInstallManifestOf().hardware.seat.holds === true;
|
|
9240
|
+
const qpuInstallManifestOf = () => ({
|
|
9241
|
+
command: 'npx uuidna-install',
|
|
9242
|
+
yes: 'npx uuidna-install --yes',
|
|
9243
|
+
prompt: 'Enter seats all. Type 1 3 saas — or all.',
|
|
9244
|
+
packages: [...installKeys],
|
|
9245
|
+
occupancies: [...occupancies],
|
|
9246
|
+
cloudflare: { button: installCloudflare.button, qpu: installCloudflare.qpu, uuidna: installCloudflare.uuidna, payload: installCloudflare.payload },
|
|
9247
|
+
hardware: {
|
|
9248
|
+
kind: 'boot',
|
|
9249
|
+
port: 8787,
|
|
9250
|
+
docker: 'docker build -t qpu . && docker run --rm -p 8787:8787 qpu',
|
|
9251
|
+
multiarch: 'docker buildx build --platform linux/arm64,linux/amd64 -t qpu .',
|
|
9252
|
+
pi: 'Alpine aarch64: apk add nodejs npm && npm i -g @uuidna/qpu && qpu-boot',
|
|
9253
|
+
prove: 'node dist/quantum/processing/unit/boot.js --prove',
|
|
9254
|
+
receipt: 'the boot passes iff qpu_prove holds inside the machine; a boot that cannot prove itself does not serve',
|
|
9255
|
+
seat: qpuSeatOf(),
|
|
9256
|
+
},
|
|
9257
|
+
holds: true,
|
|
9258
|
+
});
|
|
9259
|
+
/** .well-known/mcp.json — what a client or registry can learn without an initialize round-trip. */
|
|
9260
|
+
const qpuWellKnownOf = () => {
|
|
9261
|
+
const mcp = qpuMcpOf();
|
|
9262
|
+
return {
|
|
9263
|
+
kind: 'well-known',
|
|
9264
|
+
name: `@uuidna/${unit.kind}`,
|
|
9265
|
+
title: 'QPU',
|
|
9266
|
+
description: qpuDocsOf().abstract,
|
|
9267
|
+
url: `${unit.origin}/mcp`,
|
|
9268
|
+
transport: 'streamable-http',
|
|
9269
|
+
methods: ['POST'],
|
|
9270
|
+
batch: true,
|
|
9271
|
+
protocolVersions: MCP_VERSIONS,
|
|
9272
|
+
tools: mcp.tools.length + mcp.cybersecurity.tools.length,
|
|
9273
|
+
install: qpuHarnessesOf().rows.map((r) => ({ harness: r.harness, how: r.how })),
|
|
9274
|
+
openapi: `${unit.origin}/openapi.json`,
|
|
9275
|
+
catalog: `${unit.origin}/mcp.json`,
|
|
9276
|
+
cite: `${unit.origin}/cite`,
|
|
9277
|
+
sitemap: `${unit.origin}/sitemap.xml`,
|
|
9278
|
+
// THE COORDINATION CONTRACT (wave experience online, 2026-09-12): what an agent coordinating across gateways by
|
|
9279
|
+
// receipt needs to know before its first call — how receipts are minted, where readings live and that they
|
|
9280
|
+
// never enter a fold, how a thermometer is supplied and named, and that the seat is empty by doctrine.
|
|
9281
|
+
coordination: {
|
|
9282
|
+
receipts: { perTest: 'every test carries a computational receipt: dim, qubits, states, fold', aggregate: 'test-receipt.json', readings: 'test-readings.json — time ns, temperature mK, cracks, slowest; readings never enter a fold' },
|
|
9283
|
+
temperature: { millikelvin: 'QPU_TEMPERATURE_MILLIKELVIN', source: 'QPU_TEMPERATURE_SOURCE — name the instrument; a battery probe is not a lab', unmeasured: 'is a named crack, never a number' },
|
|
9284
|
+
seat: qpuSeatOf().doctrine,
|
|
9285
|
+
routing: 'every response names the seat it was computed on (x-qpu-seat) and the door that answered (x-qpu-door); the seat is decided per request from the referrer and the path, and the reference decides any disagreement',
|
|
9286
|
+
batch: 'a JSON-RPC batch on POST /mcp is exactly its members; notifications get no entry',
|
|
9287
|
+
law: 'a result that a receipt already holds is verified, not recomputed; a receipt minted at one gateway is read at every gateway',
|
|
9288
|
+
},
|
|
9289
|
+
holds: true,
|
|
9290
|
+
};
|
|
9291
|
+
};
|
|
9292
|
+
/** OpenAPI 3.1 over the seven paths, derived from docs.api, with the MCP tools as an extension — for the consumers
|
|
9293
|
+
* that speak OpenAPI and not MCP (gateways, Postman, OpenAI actions). */
|
|
9294
|
+
const qpuOpenApiOf = () => {
|
|
9295
|
+
const docs = qpuDocsOf();
|
|
9296
|
+
const mcp = qpuMcpOf();
|
|
9297
|
+
const paths = {};
|
|
9298
|
+
for (const a of docs.api) {
|
|
9299
|
+
const op = {
|
|
9300
|
+
operationId: `${a.method.toLowerCase()}_${a.name.replace(/[^a-z0-9]+/gi, '_')}`,
|
|
9301
|
+
summary: a.reading,
|
|
9302
|
+
...(a.method === 'POST' ? { requestBody: { required: true, content: { 'application/json': { schema: { type: 'object', description: a.path === '/mcp' ? 'a JSON-RPC 2.0 request or a batch array of them' : 'the message body' } } } } } : {}),
|
|
9303
|
+
responses: { '200': { description: 'JSON-LD', content: { 'application/ld+json': { schema: { type: 'object' } } } } },
|
|
9304
|
+
};
|
|
9305
|
+
paths[a.path] = { ...(paths[a.path] ?? {}), [a.method.toLowerCase()]: op };
|
|
9306
|
+
}
|
|
9307
|
+
return {
|
|
9308
|
+
openapi: '3.1.0',
|
|
9309
|
+
info: { title: 'QPU', version: packageVersion, description: docs.abstract, license: { name: 'CC-BY-NC-ND-4.0' } },
|
|
9310
|
+
servers: [{ url: unit.origin }],
|
|
9311
|
+
paths,
|
|
9312
|
+
'x-mcp': { endpoint: `${unit.origin}/mcp`, protocolVersions: MCP_VERSIONS, tools: [...mcp.tools, ...mcp.cybersecurity.tools].map((t) => ({ name: t.name, description: t.man.description })) },
|
|
9313
|
+
holds: true,
|
|
9314
|
+
};
|
|
9315
|
+
};
|
|
9316
|
+
const qpuSitemapOf = () => {
|
|
9317
|
+
const urls = [...new Set([...qpuDocsOf().api.filter((a) => a.method === 'GET').map((a) => a.href), `${unit.origin}/.well-known/mcp.json`, `${unit.origin}/mcp.json`, `${unit.origin}/install.json`, `${unit.origin}/openapi.json`])];
|
|
9318
|
+
return `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n${urls.map((u) => ` <url><loc>${u}</loc></url>`).join('\n')}\n</urlset>\n`;
|
|
9319
|
+
};
|
|
9320
|
+
/** THE LEARNING LADDER, STANDARDISED (QPULib's shape: one construct per worked example, in order, each with the reference
|
|
9321
|
+
* to compare against). Four steps, each with the same five fields — concept, request, expect, invariant, next — so a
|
|
9322
|
+
* reader climbs the same way every time and nothing is taught twice. Served in docs.inline and printed in the README. */
|
|
9323
|
+
const qpuLadderOf = () => [
|
|
9324
|
+
{ step: 1, concept: 'one gate, exact amplitudes', request: { method: 'GET', path: '/', tool: 'qpu_quantum' }, expect: 'Bell outcomes 00 and 11 at exactly 1/2 — Gaussian-integer amplitudes, no floats', invariant: 'H·H = I on |0⟩', theorem: 'qubits', next: 2 },
|
|
9325
|
+
{ step: 2, concept: 'entanglement is not correlation', request: { method: 'POST', path: '/mcp', tool: 'qpu_prove' }, expect: 'GHZ true; entangled true, product false — and a product state concentrates too, so concentration alone witnesses nothing', invariant: 'no-cloning and monogamy hold on the served states', theorem: 'entangle', next: 3 },
|
|
9326
|
+
{ step: 3, concept: 'Shor: a period, then a gcd', request: { method: 'POST', path: '/mcp', tool: 'crypto_shor' }, expect: `theorem shor ${shorFactorOf()} — a = 8, period 4, 7 · 13`, invariant: 'p · q = n, recomputed from the period', theorem: 'shor', next: 4 },
|
|
9327
|
+
{ step: 4, concept: 'a code corrects one flip', request: { method: 'POST', path: '/mcp', tool: 'qpu_prove' }, expect: 'bitflip distance 3, syndrome cnot cnot toffoli, logical < physical on this run', invariant: 'distance 3 corrects exactly one error', theorem: 'noise', next: 'climb: qpu_train → qpu_improve → qpu_compete → qpu_prove' },
|
|
9328
|
+
];
|
|
8318
9329
|
const payloadFinds = ['findPages', 'findUsers', 'findMedia', 'findTenants'];
|
|
8319
9330
|
let installPending = [];
|
|
8320
9331
|
let installSeated = [];
|
|
@@ -8412,7 +9423,7 @@ export const qpuPayloadMcpOf = () => {
|
|
|
8412
9423
|
holds,
|
|
8413
9424
|
};
|
|
8414
9425
|
};
|
|
8415
|
-
|
|
9426
|
+
const qpuPayloadFindOf = (name) => {
|
|
8416
9427
|
const payload = qpuPayloadMcpOf();
|
|
8417
9428
|
const plugin = payload.plugin;
|
|
8418
9429
|
const tool = payload.tools.find((row) => row.name === name);
|
|
@@ -8445,7 +9456,7 @@ export const qpuPayloadFindOf = (name) => {
|
|
|
8445
9456
|
docs: payload
|
|
8446
9457
|
};
|
|
8447
9458
|
};
|
|
8448
|
-
|
|
9459
|
+
const qpuInstallPackagesOf = () => {
|
|
8449
9460
|
const qpu = {
|
|
8450
9461
|
key: installKeys[n - n],
|
|
8451
9462
|
href: `${unit.origin}/mcp`,
|
|
@@ -8659,28 +9670,6 @@ export const qpuFusionOf = () => {
|
|
|
8659
9670
|
holds,
|
|
8660
9671
|
};
|
|
8661
9672
|
};
|
|
8662
|
-
export const qpuFusionLiveOf = async () => {
|
|
8663
|
-
const fusion = qpuFusionOf();
|
|
8664
|
-
const catalogs = await Promise.all(fusion.catalogs.map((row) => qpuResearchFetchOf(row.href)));
|
|
8665
|
-
let occupied = n - n;
|
|
8666
|
-
for (const row of catalogs)
|
|
8667
|
-
if (row.holds)
|
|
8668
|
-
occupied += seed;
|
|
8669
|
-
const vacant = catalogs.length - occupied;
|
|
8670
|
-
const holds = fusion.holds &&
|
|
8671
|
-
catalogs.length === fusion.faces &&
|
|
8672
|
-
catalogs.every((row) => row.holds && row.live === true && row.hostEscape === false) &&
|
|
8673
|
-
occupied === fusion.faces &&
|
|
8674
|
-
vacant === n - n;
|
|
8675
|
-
return {
|
|
8676
|
-
...fusion,
|
|
8677
|
-
live: true,
|
|
8678
|
-
catalogs,
|
|
8679
|
-
occupied,
|
|
8680
|
-
vacant, hostEscape: false,
|
|
8681
|
-
holds,
|
|
8682
|
-
};
|
|
8683
|
-
};
|
|
8684
9673
|
export const qpuIntelligenceOf = () => {
|
|
8685
9674
|
const circuit = qpuCircuitOf();
|
|
8686
9675
|
const fusion = qpuFusionOf();
|
|
@@ -8696,17 +9685,6 @@ export const qpuIntelligenceOf = () => {
|
|
|
8696
9685
|
holds,
|
|
8697
9686
|
};
|
|
8698
9687
|
};
|
|
8699
|
-
export const qpuIntelligenceLiveOf = async () => {
|
|
8700
|
-
const intelligence = qpuIntelligenceOf();
|
|
8701
|
-
const fusion = await qpuFusionLiveOf();
|
|
8702
|
-
const holds = intelligence.holds && fusion.holds;
|
|
8703
|
-
return {
|
|
8704
|
-
...intelligence,
|
|
8705
|
-
fusion,
|
|
8706
|
-
live: true,
|
|
8707
|
-
holds,
|
|
8708
|
-
};
|
|
8709
|
-
};
|
|
8710
9688
|
export const qpuFusionHolds = (f = qpuFusionOf()) => f.holds === true &&
|
|
8711
9689
|
f.kind === 'fusion' &&
|
|
8712
9690
|
f.theorem === 'fusion' &&
|
|
@@ -8762,18 +9740,20 @@ export const qpuCernHolds = (c = qpuCernOf()) => c.holds === true &&
|
|
|
8762
9740
|
export const qpuToolsOf = () => {
|
|
8763
9741
|
const names = toolNames;
|
|
8764
9742
|
const seeOf = (name) => names.filter((s) => s !== name);
|
|
8765
|
-
const
|
|
8766
|
-
const
|
|
8767
|
-
const
|
|
8768
|
-
const
|
|
8769
|
-
const
|
|
8770
|
-
const
|
|
8771
|
-
const
|
|
8772
|
-
const
|
|
9743
|
+
const capacity = qpuCapacityOf();
|
|
9744
|
+
const circuit = qpuCircuitOf();
|
|
9745
|
+
const quantumMan = qpuManOf(names[n - n], `The running circuit as one JSON-LD document: a ${circuit.register.qubits}-qubit state-vector simulator (dim ${circuit.register.dim}, exact integer amplitudes), the Bell and GHZ states with their Born weights, the Shor run, and the capacity count fused = faces · 2^(bits+1) = ${capacity.fused} (a count of amplitudes, not a benchmark). theorem quantum. theorem shor. theorem crypto. ${shorFactorOf()}.`, `GET ${unit.origin} returns the same document as tools/call ${names[n - n]}. Read circuit.register for the simulator, circuit.ghz.support (${circuit.ghz.support.join(',')}) for the entangled corners, shor.factors for the factoring, capacity.fused for ${capacity.fused}; every holds must be true or the unit serves 404. theorem quantum. theorem shor. theorem crypto. ${shorFactorOf()}. No auth.`, unit.origin, seeOf(names[n - n]));
|
|
9746
|
+
const leanMan = qpuManOf(names[seed], `The Lean proof, served two ways: the file index.lean as text at source.href, and every theorem as a row (statement verbatim, LaTeX formula, a plain reading, holds recomputed in TypeScript). theorem infinite. theorem distribute. theorem shor. ${shorFactorOf()}.`, `GET ${unit.href} returns the rows; read rows[] and cover[] for the theorems, source.href to fetch ${unit.fuse.lean} itself, source.fold to check the served text is the file, source.toolchain for the pinned Lean. theorem shor. ${shorFactorOf()}. No auth.`, unit.href, seeOf(names[seed]));
|
|
9747
|
+
const citeMan = qpuManOf(names[coins], 'How to cite this unit: MLA 8 entries carrying the DOI and ORCID, the served version, and the archived commit. MLA 8. when never — the citation names no access date because the DOI is the date.', `GET ${unit.origin}/cite returns citations[] (MLA 8 strings to paste), doi ${qpuCiteOf().doi}, the Zenodo archive, and the version with its commit. No auth.`, `${unit.origin}/cite`, seeOf(names[coins]));
|
|
9748
|
+
const trainMan = qpuManOf(names[n], 'Two teams of seven agents dry-clean the occupancy lattice and return the teams, the challenges, the winner, the next tasks, and steps — the autonomous walk computed from the lattice: the seat, the next door to call, and any face that does not hold. theorem infinite. coins teams of rays.', `tools/call ${names[n]} returns steps.next.door (the tool an autonomous agent calls next), steps.todo (faces to repair first), steps.walk (all fourteen faces, scanner then radar), teams[] and winner. { live: true } learn occupancy. { sequence: true } then qpu_improve then qpu_compete then qpu_prove. No auth.`, `${unit.origin}/mcp`, seeOf(names[n]));
|
|
9749
|
+
const forgeMan = qpuManOf(names[n + seed], 'Forge a tool in the in-memory sandbox: pass { name, run } where run is a sealed op tree; nothing touches disk, network, or eval. Omit name to inspect the sandbox. Unlocked in memory. No lock.', `tools/call ${names[n + seed]} with { name, run } returns the forged tool and the sandbox census (tools[], memory, unlocked); without name it returns the census. Ops ${sandboxOps.join(' ')}. No auth.`, `${unit.origin}/mcp`, seeOf(names[n + seed]));
|
|
9750
|
+
const improveMan = qpuManOf(names[n + coins], `Improve by doubling: next = fused + fused = ${capacity.fused + capacity.fused}, the next capacity rung, with before and after readings of quality, speed, and throughoutput (fused amplitudes per token of reply). The numbers are counts of amplitudes, never benchmarks. next = fused + fused.`, `tools/call ${names[n + coins]} returns next, before, after; after.throughoutput / before.throughoutput is the doubling. { live: true } learn occupancy. { sequence: true } train then improve then compete then prove. After qpu_train. Before qpu_compete. No auth.`, `${unit.origin}/mcp`, seeOf(names[n + coins]));
|
|
9751
|
+
const competeMan = qpuManOf(names[n + n], 'Two teams, read and call, compete on quality, speed, and security; the winner is the team that calls qpu_prove. theorem next_fused. throughoutput per token — fused amplitudes served per token of reply.', `tools/call ${names[n + n]} returns winner.{quality,speed,security}, teams[] with scores, and the axes. { live: true } learn occupancy. { sequence: true } train then improve then compete then prove. After qpu_improve. Winner calls qpu_prove. No auth.`, `${unit.origin}/mcp`, seeOf(names[n + n]));
|
|
9752
|
+
const proveMan = qpuManOf(names[mintOf(n) - seed], `Prove the unit end to end: every Lean row with holds, the Shor run with its receipts, the source fold of index.lean, and the evidence block; holds is their conjunction and a false anywhere makes every path 404. theorem quantum. theorem shor. theorem crypto. ${shorFactorOf()}.`, `tools/call ${names[mintOf(n) - seed]} returns theorems[] (each with holds), shor.factors, receipts, source.fold, evidence. theorem shor. theorem crypto. ${shorFactorOf()}. { live: true } sequence then prove. { sequence: true } qpu_train then qpu_improve then qpu_compete then qpu_prove. fetch Request Response. Source ${unit.fuse.lean}. After qpu_compete. No auth.`, `${unit.origin}/mcp`, seeOf(names[mintOf(n) - seed]));
|
|
8773
9753
|
const proveSchema = {
|
|
8774
9754
|
type: 'object',
|
|
8775
9755
|
properties: {
|
|
8776
|
-
man: { type: 'boolean', description: 'Return the man page
|
|
9756
|
+
man: { type: 'boolean', description: 'Return the man page: call with { man: true }. tools/list stays lean; the man page is one call away.' },
|
|
8777
9757
|
live: { type: 'boolean', description: '{ live: true } sequence then prove. fetch Request Response.' },
|
|
8778
9758
|
sequence: { type: 'boolean', description: '{ sequence: true } qpu_train then qpu_improve then qpu_compete then qpu_prove. Live. Memory.' }
|
|
8779
9759
|
}
|
|
@@ -8781,7 +9761,7 @@ export const qpuToolsOf = () => {
|
|
|
8781
9761
|
const competeSchema = {
|
|
8782
9762
|
type: 'object',
|
|
8783
9763
|
properties: {
|
|
8784
|
-
man: { type: 'boolean', description: 'Return the man page
|
|
9764
|
+
man: { type: 'boolean', description: 'Return the man page: call with { man: true }. tools/list stays lean; the man page is one call away.' },
|
|
8785
9765
|
live: { type: 'boolean', description: '{ live: true } learn CERN occupancy. fetch Request Response. Memory.' },
|
|
8786
9766
|
sequence: { type: 'boolean', description: '{ sequence: true } qpu_train then qpu_improve then qpu_compete then qpu_prove. Live. Memory.' },
|
|
8787
9767
|
team: { type: 'string', description: 'read or call. Omit for both teams.' }
|
|
@@ -8790,7 +9770,7 @@ export const qpuToolsOf = () => {
|
|
|
8790
9770
|
const forgeSchema = {
|
|
8791
9771
|
type: 'object',
|
|
8792
9772
|
properties: {
|
|
8793
|
-
man: { type: 'boolean', description: 'Return the man page
|
|
9773
|
+
man: { type: 'boolean', description: 'Return the man page: call with { man: true }. tools/list stays lean; the man page is one call away.' },
|
|
8794
9774
|
name: { type: 'string', description: 'Tool name to forge. Omit to inspect the in-memory sandbox.' },
|
|
8795
9775
|
team: { type: 'string', description: 'read or call.' },
|
|
8796
9776
|
ray: { type: 'number', description: 'Agent ray 0..6.' },
|
|
@@ -8858,16 +9838,67 @@ export const qpuToolsOf = () => {
|
|
|
8858
9838
|
}
|
|
8859
9839
|
];
|
|
8860
9840
|
};
|
|
9841
|
+
/** The schemas, derived once per isolate from each tool's replies: the default call, and for the five tools that take
|
|
9842
|
+
* n and a, a second call on 15 and 7 so that `required` is what every reply carries. While they are being derived,
|
|
9843
|
+
* tools/list answers with the minimal schema, so a tool whose reply lists the tools does not recurse. */
|
|
9844
|
+
let outputSchemasMemo;
|
|
9845
|
+
let outputSchemasBuilding = false;
|
|
9846
|
+
const qpuOutputSchemasOf = () => {
|
|
9847
|
+
if (outputSchemasMemo)
|
|
9848
|
+
return outputSchemasMemo;
|
|
9849
|
+
if (outputSchemasBuilding)
|
|
9850
|
+
return {};
|
|
9851
|
+
outputSchemasBuilding = true;
|
|
9852
|
+
const out = {};
|
|
9853
|
+
const sample = (run, args) => {
|
|
9854
|
+
const r = run(args);
|
|
9855
|
+
return r && typeof r === 'object' && typeof r.then === 'function' ? undefined : r;
|
|
9856
|
+
};
|
|
9857
|
+
for (const t of qpuToolsOf())
|
|
9858
|
+
out[t.name] = qpuOutputSchemaOf([sample(t.run, {})].filter((x) => x !== undefined));
|
|
9859
|
+
const withArgs = new Set(['crypto_shor', 'crypto_cmodexp', 'crypto_iqft', 'crypto_shots', 'crypto_rsa']);
|
|
9860
|
+
for (const t of qpuCybersecurityToolsOf()) {
|
|
9861
|
+
/** Three samples for the five tools that take n and a: the unit's own 91, a small 15, and 2^61 sent as digits, so the
|
|
9862
|
+
* derived types of n, a, p, q and product are integer-or-string, as the replies past 2^53 are. */
|
|
9863
|
+
const past = (b1 << BigInt(mintOf(n) * mintOf(n) - n)).toString();
|
|
9864
|
+
const samples = withArgs.has(t.name)
|
|
9865
|
+
? [sample(t.run, {}), sample(t.run, { n: n * (n + coins), a: n + coins + coins }), sample(t.run, { n: past, a: `${n}` })]
|
|
9866
|
+
: [sample(t.run, {})];
|
|
9867
|
+
out[t.name] = qpuOutputSchemaOf(samples.filter((x) => x !== undefined));
|
|
9868
|
+
}
|
|
9869
|
+
outputSchemasBuilding = false;
|
|
9870
|
+
outputSchemasMemo = out;
|
|
9871
|
+
return out;
|
|
9872
|
+
};
|
|
9873
|
+
/** THE CONNECT BILL (the captain, 2026-09-12: "minimise bills of any kind"). tools/list is paid by every client on every
|
|
9874
|
+
* connect, in context tokens: the sixteen output schemas were 34,232 of its 44,197 bytes — three quarters of the bill
|
|
9875
|
+
* for a document a client validates a reply against at most once. They leave the list and travel with the man page,
|
|
9876
|
+
* one call away ({ man: true }), exactly as the man pages did. The list is names, descriptions, input schemas and
|
|
9877
|
+
* annotations: one KiB per door, guarded by the suite. */
|
|
9878
|
+
export const qpuMcpToolsListOf = () => {
|
|
9879
|
+
const sealed = qpuToolsOf().map(({ name, description, inputSchema }) => qpuMcpToolShapeOf(name, description, inputSchema, { sealed: true, morph: false }));
|
|
9880
|
+
const cybersecurity = qpuCybersecurityToolsOf().map(({ name, description, inputSchema }) => qpuMcpToolShapeOf(name, description, inputSchema, { sealed: false, morph: true }));
|
|
9881
|
+
return [...sealed, ...cybersecurity];
|
|
9882
|
+
};
|
|
9883
|
+
/** The man page as served: the tool's man plus its output schema read from the run, off the list and one call away. */
|
|
9884
|
+
const qpuManPageOf = (name, man) => ({
|
|
9885
|
+
...man,
|
|
9886
|
+
outputSchema: qpuOutputSchemasOf()[name] ?? minimalOutputSchema,
|
|
9887
|
+
});
|
|
8861
9888
|
export const qpuMcpOf = () => {
|
|
8862
9889
|
const href = `${unit.origin}/mcp`;
|
|
8863
9890
|
const faces = qpuFacesOf();
|
|
8864
9891
|
const circuit = qpuCircuitOf();
|
|
8865
9892
|
const capacity = qpuCapacityOf();
|
|
9893
|
+
const shor = qpuShorOf();
|
|
9894
|
+
const encrypt = qpuEncryptOf();
|
|
8866
9895
|
const cite = qpuCiteOf();
|
|
8867
9896
|
const tools = qpuToolsOf().map(({ name, description, inputSchema, man }, i) => {
|
|
8868
9897
|
const position = i + seed;
|
|
8869
9898
|
return {
|
|
8870
9899
|
'@type': 'SoftwareApplication',
|
|
9900
|
+
/** the vendor shapes, off the MCP wire and onto the catalogue: Anthropic input_schema, OpenAI function, Gemini functionDeclarations */
|
|
9901
|
+
vendors: { anthropic: { name, description, input_schema: inputSchema }, openai: { type: 'function', function: { name, description, parameters: inputSchema } }, gemini: { functionDeclarations: [{ name, description, parameters: inputSchema }] } },
|
|
8871
9902
|
'@id': `${href}#${name}`,
|
|
8872
9903
|
url: href,
|
|
8873
9904
|
position,
|
|
@@ -8896,13 +9927,31 @@ export const qpuMcpOf = () => {
|
|
|
8896
9927
|
}
|
|
8897
9928
|
}))
|
|
8898
9929
|
};
|
|
9930
|
+
const cybersecurity = qpuCybersecurityToolsOf().map(({ name, description, inputSchema, man }, i) => {
|
|
9931
|
+
const position = i + seed;
|
|
9932
|
+
return {
|
|
9933
|
+
'@type': 'SoftwareApplication',
|
|
9934
|
+
'@id': `${href}#${name}`,
|
|
9935
|
+
url: href,
|
|
9936
|
+
position,
|
|
9937
|
+
name,
|
|
9938
|
+
description,
|
|
9939
|
+
inputSchema,
|
|
9940
|
+
man,
|
|
9941
|
+
sealed: false,
|
|
9942
|
+
morph: true
|
|
9943
|
+
};
|
|
9944
|
+
});
|
|
8899
9945
|
const holds = circuit.only.holds &&
|
|
8900
9946
|
capacity.holds &&
|
|
8901
9947
|
tools.length === mintOf(n) &&
|
|
8902
9948
|
tools.every((t) => qpuManHolds(t.man) && t.man.name === t.name) &&
|
|
8903
9949
|
hasPart.numberOfItems === mintOf(n) &&
|
|
8904
9950
|
hasPart.itemListElement.length === mintOf(n) &&
|
|
8905
|
-
hasPart.itemListElement.every((row, i) => row.position === i + seed && row.item.name === tools[i]?.name)
|
|
9951
|
+
hasPart.itemListElement.every((row, i) => row.position === i + seed && row.item.name === tools[i]?.name) &&
|
|
9952
|
+
cybersecurity.length === mintOf(n) &&
|
|
9953
|
+
cybersecurity.every((t) => t.man.holds && t.man.name === t.name) &&
|
|
9954
|
+
qpuMcpToolsListOf().length === mintOf(n) + mintOf(n);
|
|
8906
9955
|
return {
|
|
8907
9956
|
'@context': qpuContextOf(),
|
|
8908
9957
|
'@type': 'WebAPI',
|
|
@@ -8913,7 +9962,9 @@ export const qpuMcpOf = () => {
|
|
|
8913
9962
|
license: 'CC-BY-NC-ND-4.0',
|
|
8914
9963
|
provider: {
|
|
8915
9964
|
'@type': 'Person',
|
|
8916
|
-
name: `${cite.author.first} ${cite.author.last}
|
|
9965
|
+
name: `${cite.author.first} ${cite.author.last}`,
|
|
9966
|
+
identifier: cite.author.orcid,
|
|
9967
|
+
sameAs: cite.author.orcid,
|
|
8917
9968
|
},
|
|
8918
9969
|
kind: 'quantum',
|
|
8919
9970
|
only: circuit.only,
|
|
@@ -8932,13 +9983,23 @@ export const qpuMcpOf = () => {
|
|
|
8932
9983
|
cors,
|
|
8933
9984
|
tools,
|
|
8934
9985
|
hasPart,
|
|
9986
|
+
cybersecurity: {
|
|
9987
|
+
kind: 'cybersecurity',
|
|
9988
|
+
theorem: 'crypto',
|
|
9989
|
+
listed: true,
|
|
9990
|
+
morph: true,
|
|
9991
|
+
sealed: false,
|
|
9992
|
+
rsa: { kind: 'rsa', cryptosystem: 'rsa', modulus: shor.n, p: shor.factors.p, q: shor.factors.q, factored: shor.rsa.factored, unlocked: shor.unlocked },
|
|
9993
|
+
encrypt: { kind: encrypt.kind, theorem: encrypt.theorem, identity: encrypt.identity, holds: encrypt.holds },
|
|
9994
|
+
tools: cybersecurity
|
|
9995
|
+
},
|
|
8935
9996
|
prove: {
|
|
8936
9997
|
ui: { href: unit.origin, mcp: href, door: 'qpu_prove' },
|
|
8937
9998
|
cern: { faces: faces.faces },
|
|
8938
9999
|
coil: { theorem: 'two_coins_make_a_coil', faces: faces.faces },
|
|
8939
10000
|
entangle: { product: seed * seed === (n - n) * (n - n), pairs: faces.rays },
|
|
8940
10001
|
next: { theorem: 'next_coil' },
|
|
8941
|
-
shor: { n:
|
|
10002
|
+
shor: { n: qpuFacesOf().rays * (n * n + n + seed), a: mintOf(n), qft: 'iqft', product: qpuFacesOf().rays * (n * n + n + seed), rsa: true, p: qpuFacesOf().rays, q: n * n + n + seed, unlocked: true },
|
|
8942
10003
|
src: unit.fuse.lean
|
|
8943
10004
|
},
|
|
8944
10005
|
sandbox: { kind: 'sandbox',
|
|
@@ -8946,7 +10007,7 @@ export const qpuMcpOf = () => {
|
|
|
8946
10007
|
holds,
|
|
8947
10008
|
};
|
|
8948
10009
|
};
|
|
8949
|
-
export const qpuMcpCallOf = async (name, args = {}) => {
|
|
10010
|
+
export const qpuMcpCallOf = async (name, args = {}, env, auth) => {
|
|
8950
10011
|
const shown = async (payload) => qpuMcpShownOf(name, payload);
|
|
8951
10012
|
const tool = qpuToolsOf().find((t) => t.name === name);
|
|
8952
10013
|
if (tool) {
|
|
@@ -8968,12 +10029,27 @@ export const qpuMcpCallOf = async (name, args = {}) => {
|
|
|
8968
10029
|
}
|
|
8969
10030
|
if (name === 'install' || name === 'apk') {
|
|
8970
10031
|
if (args.man === true) {
|
|
8971
|
-
return shown(qpuManOf('install', 'Interactive installer. Simulate, then commit. Fuse Payload MCP to QPU without a ninth sealed tool. VitePress payload stays on uuidna.com.', `tools/call install. Not in tools/list. { yes: true } seats the current package. { verb: "simulate" } then { verb: "commit", yes: true } then { verb: "audit" }. QPU JSON-LD. No auth.`, `${unit.origin}/mcp`, [...toolNames]));
|
|
10032
|
+
return shown(qpuManPageOf('install', qpuManOf('install', 'Interactive installer. Simulate, then commit. Fuse Payload MCP to QPU without a ninth sealed tool. VitePress payload stays on uuidna.com.', `tools/call install. Not in tools/list. { yes: true } seats the current package. { verb: "simulate" } then { verb: "commit", yes: true } then { verb: "audit" }. QPU JSON-LD. No auth.`, `${unit.origin}/mcp`, [...toolNames])));
|
|
8972
10033
|
}
|
|
8973
10034
|
return shown(qpuInstallOf(args));
|
|
8974
10035
|
}
|
|
8975
|
-
if (payloadFinds.includes(name))
|
|
10036
|
+
if (payloadFinds.includes(name)) {
|
|
10037
|
+
if (args.man === true) {
|
|
10038
|
+
return shown(qpuManPageOf(name, qpuSubManOf(name, 'Payload find. Read only.', 'Not in tools/list. Morph at call time. Not a ninth sealed tool. No auth. Write never.', `${unit.origin}/mcp`, payloadFinds.filter((row) => row !== name))));
|
|
10039
|
+
}
|
|
8976
10040
|
return shown(qpuPayloadFindOf(name));
|
|
10041
|
+
}
|
|
10042
|
+
const morph = [
|
|
10043
|
+
...qpuCybersecurityToolsOf(),
|
|
10044
|
+
...qpuStorageToolsOf(env, auth),
|
|
10045
|
+
...qpuNetworkToolsOf(),
|
|
10046
|
+
...qpuServerToolsOf(),
|
|
10047
|
+
].find((t) => t.name === name);
|
|
10048
|
+
if (morph) {
|
|
10049
|
+
if (args.man === true)
|
|
10050
|
+
return shown(qpuManPageOf(name, morph.man));
|
|
10051
|
+
return shown(await morph.run(args));
|
|
10052
|
+
}
|
|
8977
10053
|
seedSandboxOf();
|
|
8978
10054
|
const href = typeof args.href === 'string' ? args.href : typeof args.path === 'string' ? args.path : '';
|
|
8979
10055
|
if (name === 'fetch' && qpuCernHrefOf(href) !== undefined) {
|
|
@@ -8995,8 +10071,10 @@ export const qpuMcpCallOf = async (name, args = {}) => {
|
|
|
8995
10071
|
}
|
|
8996
10072
|
if (sandboxTools.has(name))
|
|
8997
10073
|
return shown(qpuSandboxRunOf(name, args));
|
|
8998
|
-
return
|
|
10074
|
+
return qpuUnknownToolOf(name);
|
|
8999
10075
|
};
|
|
10076
|
+
const qpuUnknownToolOf = (tool) => ({ kind: 'unknown', tool, tools: qpuMcpToolsListOf().map((t) => t.name), holds: false });
|
|
10077
|
+
export const isUnknownTool = (x) => typeof x === 'object' && x !== null && x.kind === 'unknown' && typeof x.tool === 'string' && x.holds === false;
|
|
9000
10078
|
export const qpuMcpHolds = (m = qpuMcpOf()) => {
|
|
9001
10079
|
const capacity = qpuCapacityOf();
|
|
9002
10080
|
const circuit = qpuCircuitOf();
|
|
@@ -9009,6 +10087,7 @@ export const qpuMcpHolds = (m = qpuMcpOf()) => {
|
|
|
9009
10087
|
qpuImproveHolds() &&
|
|
9010
10088
|
qpuCompeteHolds() &&
|
|
9011
10089
|
qpuProveHolds() &&
|
|
10090
|
+
qpuCybersecurityHolds() &&
|
|
9012
10091
|
qpuMessageHolds() &&
|
|
9013
10092
|
m.holds === true &&
|
|
9014
10093
|
m.kind === 'quantum' &&
|
|
@@ -9031,6 +10110,25 @@ export const qpuMcpHolds = (m = qpuMcpOf()) => {
|
|
|
9031
10110
|
m.tools[n + n]?.name === 'qpu_compete' &&
|
|
9032
10111
|
m.tools[mintOf(n) - seed]?.name === 'qpu_prove' &&
|
|
9033
10112
|
m.tools.every((t) => qpuManHolds(t.man) && t.man.name === t.name) &&
|
|
10113
|
+
m.cybersecurity.listed === true &&
|
|
10114
|
+
m.cybersecurity.sealed === false &&
|
|
10115
|
+
m.cybersecurity.morph === true &&
|
|
10116
|
+
m.cybersecurity.tools.length === mintOf(n) &&
|
|
10117
|
+
m.cybersecurity.tools[n - n]?.name === 'crypto_catalog' &&
|
|
10118
|
+
m.cybersecurity.tools[n + coins]?.name === 'crypto_rsa' &&
|
|
10119
|
+
m.cybersecurity.tools[mintOf(n) - seed]?.name === 'crypto_verify' &&
|
|
10120
|
+
m.cybersecurity.rsa.kind === 'rsa' &&
|
|
10121
|
+
m.cybersecurity.rsa.factored === true &&
|
|
10122
|
+
m.cybersecurity.rsa.unlocked === true &&
|
|
10123
|
+
m.cybersecurity.rsa.modulus === qpuFacesOf().rays * (n * n + n + seed) &&
|
|
10124
|
+
m.cybersecurity.rsa.p * m.cybersecurity.rsa.q === m.cybersecurity.rsa.modulus &&
|
|
10125
|
+
m.cybersecurity.encrypt.kind === 'encrypt' &&
|
|
10126
|
+
m.cybersecurity.encrypt.theorem === 'crypto' &&
|
|
10127
|
+
m.cybersecurity.encrypt.identity === true &&
|
|
10128
|
+
m.cybersecurity.encrypt.holds === true &&
|
|
10129
|
+
qpuMcpToolsListOf().length === mintOf(n) + mintOf(n) &&
|
|
10130
|
+
qpuMcpToolsListOf().slice(n - n, mintOf(n)).every((t, i) => t.name === toolNames[i]) &&
|
|
10131
|
+
qpuMcpToolsListOf().slice(mintOf(n)).every((t, i) => t.name === cryptoToolNames[i]) &&
|
|
9034
10132
|
jsonldHoldsOf(m) &&
|
|
9035
10133
|
m['@type'] === 'WebAPI' &&
|
|
9036
10134
|
m['@id'] === m.href &&
|
|
@@ -9049,10 +10147,13 @@ export const qpuMcpHolds = (m = qpuMcpOf()) => {
|
|
|
9049
10147
|
m.prove.entangle.product === false &&
|
|
9050
10148
|
m.prove.entangle.pairs === qpuFacesOf().rays &&
|
|
9051
10149
|
m.prove.next.theorem === 'next_coil' &&
|
|
9052
|
-
m.prove.shor.n ===
|
|
9053
|
-
m.prove.shor.a ===
|
|
10150
|
+
m.prove.shor.n === qpuFacesOf().rays * (n * n + n + seed) &&
|
|
10151
|
+
m.prove.shor.a === mintOf(n) &&
|
|
9054
10152
|
m.prove.shor.qft === 'iqft' &&
|
|
9055
|
-
m.prove.shor.product ===
|
|
10153
|
+
m.prove.shor.product === qpuFacesOf().rays * (n * n + n + seed) &&
|
|
10154
|
+
m.prove.shor.rsa === true &&
|
|
10155
|
+
m.prove.shor.unlocked === true &&
|
|
10156
|
+
m.prove.shor.p * m.prove.shor.q === m.prove.shor.n &&
|
|
9056
10157
|
m.prove.src === unit.fuse.lean &&
|
|
9057
10158
|
qpuHostsHolds() &&
|
|
9058
10159
|
qpuDevelopHolds());
|
|
@@ -9069,7 +10170,6 @@ export const qpuDevelopOf = () => {
|
|
|
9069
10170
|
const faces = qpuFacesOf();
|
|
9070
10171
|
const cube = qpuCubeOf();
|
|
9071
10172
|
const handle = qpuHandleOf();
|
|
9072
|
-
const none = n - n;
|
|
9073
10173
|
const exclusive = cern.entangle.pairs.filter((pair) => pair.same === false);
|
|
9074
10174
|
const zip = exclusive.map((pair) => `${pair.scanner.experiment}↔${pair.radar.experiment}`);
|
|
9075
10175
|
const lines = [
|
|
@@ -9084,18 +10184,19 @@ export const qpuDevelopOf = () => {
|
|
|
9084
10184
|
'`npm test` compiles then runs the unit tests. `npm run ci` is Lean then test. `npm run ship` deploys. Do not import uuidna.',
|
|
9085
10185
|
'',
|
|
9086
10186
|
`- host ${unit.host}. API only JSON-LD. No HTML. No auth. cors *.`,
|
|
9087
|
-
`- sealed tools ${tools.length} = mintOf n. tools/list
|
|
10187
|
+
`- sealed tools ${tools.length} = mintOf n. tools/list lists those eight plus eight cybersecurity morph. crypto_rsa theorem shor ${shorFactorOf()}. crypto_split theorem crypto ${cryptoClaimOf()}. Unlocked. Not a ninth sealed tool. Morph install Payload finds imagine at call-time.`,
|
|
9088
10188
|
`- docs.api ${docs.api.length} = rays. Extra paths do not join that list.`,
|
|
9089
10189
|
`- integrity ${integrity.n}: ${integrity.tests.map((row) => row.name).join(' ')}. If false every path is 404.`,
|
|
9090
10190
|
`- primitives ${primitives.join(' ')}. Never Math.`,
|
|
9091
|
-
`-
|
|
10191
|
+
`- theorem temperature. theorem superconductivity. theorem qubits. device ${circuit.hardware.device}. KV added amplitudes.`,
|
|
9092
10192
|
`- fuse faces * mintOf (bits + seed) = ${quantum.fused}. isolate handle.amplitudes ${handle.amplitudes}. KV ${handle.kv.amplitudes}.`,
|
|
9093
|
-
`- next = fused + fused. last false. split_coin has no last k. demo is not a test nor a proof. Capacity infinite.`,
|
|
10193
|
+
`- next = fused + fused. last false. split_coin has no last k. demo is not a test nor a proof. Capacity infinite. Crypt split to free agents.`,
|
|
9094
10194
|
`- occupancy ${occupancies.join(' ')}. skills ${skills.join(' ')}. Coordinated dry-clean.`,
|
|
10195
|
+
`- steps computed from the lattice: seat ${qpuStepsOf().seat}, next ${qpuStepsOf().next.node} at face ${qpuStepsOf().next.face} via ${qpuStepsOf().next.door.tool}, todo ${qpuStepsOf().todo.length}. Walk scanner then radar by the hop of rays, ray by ray.`,
|
|
9095
10196
|
`- domains ${genesis.domains.join(' ')}. Lattice flow domains. face = team * rays + ray. hop face + rays. involution face + rays + rays.`,
|
|
9096
10197
|
`- circuit.gates ${circuit.gates.names.join(' ')}.`,
|
|
9097
10198
|
`- sandbox memory only. Not KV. VM scaling online.`,
|
|
9098
|
-
`- CERN coins views. scanner LHC running ${cern.learn.lhc.join(' ')}. radar Open Data ${cern.learn.opendata.join(' ')}. Shared tetra + TOTEM. Exclusive ${zip.join(' ')}. Catalog pairs ${faces.rays}. HEP quantum true. Live JSON. Open Data needs records. LHC-only holds without Open Data occupancy.`
|
|
10199
|
+
`- CERN coins views. scanner LHC running ${cern.learn.lhc.join(' ')}. radar Open Data ${cern.learn.opendata.join(' ')}. Shared tetra + TOTEM. Exclusive ${zip.join(' ')}. Catalog pairs ${faces.rays}. HEP quantum true. Live CERN Open Data APIs. Live JSON. Open Data needs records. LHC-only holds without Open Data occupancy.`
|
|
9099
10200
|
];
|
|
9100
10201
|
const reading = lines.join('\n');
|
|
9101
10202
|
const holds = lean.holds &&
|
|
@@ -9107,10 +10208,8 @@ export const qpuDevelopOf = () => {
|
|
|
9107
10208
|
integrity.tests.length === n &&
|
|
9108
10209
|
genesis.domains.length === coins &&
|
|
9109
10210
|
genesis.domains.join(' ') === 'scanner radar' &&
|
|
9110
|
-
circuit.fridge.resistance === n - n &&
|
|
9111
10211
|
circuit.gates.names.length === coins &&
|
|
9112
10212
|
circuit.gates.names.join(' ') === 'h cnot' &&
|
|
9113
|
-
quantum.speed.ns === none &&
|
|
9114
10213
|
quantum.next === quantum.fused + quantum.fused &&
|
|
9115
10214
|
handle.amplitudes === mintOf(cube.bits) &&
|
|
9116
10215
|
handle.kv.amplitudes === mintOf(cube.bits + seed) &&
|
|
@@ -9128,6 +10227,13 @@ export const qpuDevelopOf = () => {
|
|
|
9128
10227
|
reading.includes('This README is generated') &&
|
|
9129
10228
|
reading.includes('Do not import uuidna') &&
|
|
9130
10229
|
reading.includes('Not a ninth sealed tool') &&
|
|
10230
|
+
reading.includes(`${shorFactorOf()}`) &&
|
|
10231
|
+
reading.includes('theorem shor') &&
|
|
10232
|
+
reading.includes('theorem crypto') &&
|
|
10233
|
+
reading.includes('theorem temperature') &&
|
|
10234
|
+
reading.includes('theorem superconductivity') &&
|
|
10235
|
+
reading.includes('theorem qubits') &&
|
|
10236
|
+
reading.includes('Unlocked') &&
|
|
9131
10237
|
reading.includes('demo is not a test nor a proof') &&
|
|
9132
10238
|
reading.includes('API only JSON-LD') &&
|
|
9133
10239
|
reading.includes('No HTML') &&
|
|
@@ -9142,7 +10248,6 @@ export const qpuDevelopOf = () => {
|
|
|
9142
10248
|
tools: tools.length,
|
|
9143
10249
|
api: docs.api.length,
|
|
9144
10250
|
integrity: integrity.n,
|
|
9145
|
-
ns: quantum.speed.ns,
|
|
9146
10251
|
fused: quantum.fused,
|
|
9147
10252
|
lhc: cern.learn.lhc,
|
|
9148
10253
|
opendata: cern.learn.opendata,
|
|
@@ -9158,279 +10263,392 @@ export const qpuDevelopHolds = (d = qpuDevelopOf()) => d.holds === true &&
|
|
|
9158
10263
|
d.tools === mintOf(n) &&
|
|
9159
10264
|
d.api === qpuFacesOf().rays &&
|
|
9160
10265
|
d.integrity === n &&
|
|
9161
|
-
d.ns === n - n &&
|
|
9162
10266
|
d.lhc.length === n * n &&
|
|
9163
10267
|
d.opendata.length === n * n &&
|
|
9164
10268
|
d.exclusive.length === mintOf(coins) &&
|
|
9165
10269
|
d.reading.includes('Lean') &&
|
|
9166
10270
|
d.src === unit.fuse.lean;
|
|
10271
|
+
/** THE README IS THE npm PAGE. Read as the package's front door on npmjs.com (2026-09-12): the first screen had no
|
|
10272
|
+
* install line, no usage, and the same tag sentences repeated down the page — "demo is not a test nor a proof" five
|
|
10273
|
+
* times, "theorem shor. Factor 91." fifteen. Every claim is kept (qpuReadmeHolds pins each one, verbatim), but a
|
|
10274
|
+
* reader now meets install → use → routes → tools as tables, and each pinned sentence is said once. Nothing here is
|
|
10275
|
+
* typed twice: descriptions, readings, citations and harness recipes are the served objects printed. */
|
|
9167
10276
|
export const qpuReadmeOf = (m = qpuMcpOf()) => {
|
|
9168
10277
|
const lean = qpuLeanOf();
|
|
9169
10278
|
const quantum = qpuQuantumOf();
|
|
9170
|
-
const develop = qpuDevelopOf();
|
|
9171
10279
|
const cite = qpuCiteOf();
|
|
9172
|
-
const efficiency = qpuEfficiencyOf();
|
|
9173
|
-
const train = qpuTrainOf();
|
|
9174
|
-
const sandbox = qpuSandboxOf();
|
|
9175
|
-
const improve = qpuImproveOf();
|
|
9176
|
-
const compete = qpuCompeteOf();
|
|
9177
10280
|
const prove = qpuProveOf();
|
|
9178
10281
|
const docs = quantum.docs;
|
|
9179
|
-
const
|
|
10282
|
+
const blueprint = unit.fuse.src;
|
|
10283
|
+
const harness = qpuHarnessesOf();
|
|
10284
|
+
const row = (...cells) => `| ${cells.join(' | ')} |`;
|
|
9180
10285
|
const lines = [
|
|
9181
|
-
`#
|
|
10286
|
+
`# QPU`,
|
|
10287
|
+
'',
|
|
10288
|
+
`\`@uuidna/qpu\` — Running quantum circuit at ${unit.origin}: a 3-qubit exact state-vector simulator, its Lean 4 proofs, and an MCP server in one Cloudflare Worker. theorem quantum : fused = faces * mintOf (bits + seed). Public quantum API. No auth. JSON-LD. CORS ${cors}. API only. No HTML. The TypeScript and Lean sources are the blueprint; this README is the paper generated from that blueprint.`,
|
|
9182
10289
|
'',
|
|
9183
|
-
|
|
10290
|
+
'```sh',
|
|
10291
|
+
'npm install @uuidna/qpu',
|
|
10292
|
+
'```',
|
|
9184
10293
|
'',
|
|
9185
|
-
'
|
|
10294
|
+
'```ts',
|
|
10295
|
+
"import { qpuMcpCallOf, qpuMcpOf } from '@uuidna/qpu'",
|
|
9186
10296
|
'',
|
|
9187
|
-
|
|
10297
|
+
'const catalog = qpuMcpOf() // the MCP catalog: tools, schemas, install recipes',
|
|
10298
|
+
"const circuit = await qpuMcpCallOf('qpu_quantum') // the running circuit as one JSON-LD document",
|
|
10299
|
+
'```',
|
|
9188
10300
|
'',
|
|
9189
|
-
|
|
10301
|
+
`Or without installing: \`GET ${unit.origin}\`, or \`POST ${m.href}\` with JSON-RPC \`tools/list\` then \`tools/call\`. Do not import uuidna; this package stands alone. Source \`${lean.src}\`.`,
|
|
9190
10302
|
'',
|
|
9191
|
-
'##
|
|
10303
|
+
'## Abstract',
|
|
9192
10304
|
'',
|
|
9193
|
-
`
|
|
10305
|
+
`A named host ${unit.host} exposes one quantum processing unit as JSON-LD. fused is ${quantum.fused}; next is fused + fused = ${quantum.next}. Native gates are h and cnot. theorem temperature, theorem superconductivity, theorem qubits, theorem shor and theorem crypto are decided in Lean. GHZ ${quantum.purpose.nature.ghz}; entangled ${quantum.purpose.nature.entangled}, product ${quantum.purpose.nature.product}. Possible only in quantum. demo is not a test nor a proof.`,
|
|
9194
10306
|
'',
|
|
9195
|
-
|
|
10307
|
+
'## Unit',
|
|
9196
10308
|
'',
|
|
9197
|
-
`
|
|
10309
|
+
`The blueprint is \`${blueprint}\` fused with \`${lean.src}\`. theorem quantum, theorem infinite, and theorem distribute are decided in Lean, not restated as chapters here.`,
|
|
9198
10310
|
'',
|
|
9199
|
-
|
|
10311
|
+
row('Constant', 'Value'),
|
|
10312
|
+
row('---', '---'),
|
|
10313
|
+
row('mintOf(k)', '2^k by doubling'),
|
|
10314
|
+
row('n', '3'),
|
|
10315
|
+
row('seed', '1'),
|
|
10316
|
+
row('coins', '2'),
|
|
10317
|
+
row('rays', '7'),
|
|
10318
|
+
row('faces', '14'),
|
|
10319
|
+
row('bits', '32'),
|
|
10320
|
+
row('cube vertices', String(quantum.cube.vertices)),
|
|
10321
|
+
row('hexbit', String(quantum.cube.hexbit)),
|
|
9200
10322
|
'',
|
|
9201
|
-
`
|
|
10323
|
+
`Climb ${quantum.purpose.science.climb.join(' then ')}. Extras ${quantum.purpose.science.extras.join(' ')} stay off the seven-path guide. Integrity is three tests: quantum, lean, sealed. If they fail every path is 404.`,
|
|
9202
10324
|
'',
|
|
9203
|
-
'##
|
|
10325
|
+
'## Interface',
|
|
10326
|
+
'',
|
|
10327
|
+
`Seven paths. Eight sealed MCP tools, plus eight cybersecurity morph tools listed on tools/list. Extra paths do not join that list. Not a ninth sealed tool. User guide is docs.inline on the unit. Theorems are qpu_lean and qpu_prove. \`{ man: true }\` is the theorem on the wire.`,
|
|
9204
10328
|
'',
|
|
9205
|
-
|
|
10329
|
+
row('Route', 'Tool', 'Reading'),
|
|
10330
|
+
row('---', '---', '---'),
|
|
10331
|
+
...docs.api.map((r) => row(`\`${r.method} ${r.path}\``, r.name, r.reading)),
|
|
9206
10332
|
'',
|
|
9207
|
-
|
|
10333
|
+
row('Tool', 'What it returns'),
|
|
10334
|
+
row('---', '---'),
|
|
10335
|
+
...m.tools.map((t) => row(`\`${t.name}\``, t.man.description)),
|
|
9208
10336
|
'',
|
|
9209
|
-
`
|
|
10337
|
+
`Cybersecurity morph tools. crypto_rsa theorem shor ${shorFactorOf()}. crypto_split theorem crypto ${cryptoClaimOf()}.`,
|
|
9210
10338
|
'',
|
|
9211
|
-
`
|
|
10339
|
+
`Discovery, off the seven-path guide: \`/.well-known/mcp.json\` \`/mcp.json\` \`/install.json\` \`/openapi.json\` \`/sitemap.xml\`. JSON-RPC batches accepted on \`POST /mcp\`; a \`GET /mcp\` asking for an event stream gets 405 with Allow, so streamable-HTTP clients fall back to POST.`,
|
|
9212
10340
|
'',
|
|
9213
|
-
|
|
10341
|
+
row('Tool', 'Claim'),
|
|
10342
|
+
row('---', '---'),
|
|
10343
|
+
...m.cybersecurity.tools.map((t) => row(`\`${t.name}\``, t.man.description)),
|
|
9214
10344
|
'',
|
|
9215
|
-
|
|
10345
|
+
'## Results',
|
|
9216
10346
|
'',
|
|
9217
|
-
`
|
|
10347
|
+
`theorem shor ${shorFactorOf()}. theorem crypto ${cryptoClaimOf()}.`,
|
|
9218
10348
|
'',
|
|
9219
|
-
'
|
|
10349
|
+
'```lean',
|
|
10350
|
+
prove.theorems.find((r) => r.heading === 'shor')?.theorem ?? '',
|
|
10351
|
+
prove.theorems.find((r) => r.heading === 'crypto')?.theorem ?? '',
|
|
10352
|
+
'```',
|
|
10353
|
+
'',
|
|
10354
|
+
`Fault tolerance: ${quantum.evidence.fault.code}, distance ${quantum.evidence.fault.distance}, codes ${quantum.evidence.fault.codes}, syndrome ${quantum.evidence.fault.syndrome.join(' ')}, logical off ${quantum.evidence.fault.logical.off}; logical < physical ${quantum.evidence.fault.logicalLtPhysical} on this run, one distance.`,
|
|
10355
|
+
'',
|
|
10356
|
+
`CERN Open Data ${quantum.evidence.verify.cern}. LHC running. Four CMS records. Coil, electronics, hybrid, raid, and clay identities are in \`${lean.src}\`; theorem clay is coins * rays = faces.`,
|
|
10357
|
+
'',
|
|
10358
|
+
'## Evidence',
|
|
10359
|
+
'',
|
|
10360
|
+
row('Measurement', 'Value'),
|
|
10361
|
+
row('---', '---'),
|
|
10362
|
+
row('Execution provenance', `provider ${quantum.evidence.provenance.provider}, device ${quantum.evidence.provenance.device}, job ${quantum.evidence.provenance.job}, shots ${quantum.evidence.provenance.shots}`),
|
|
10363
|
+
row('Compiler', `native ${quantum.evidence.provenance.compiler.native.join(' ')}; compiled ${quantum.evidence.provenance.compiler.compiled.join(' ')}`),
|
|
10364
|
+
row('Device-specific noise', `channel ${quantum.evidence.noise.model}, drift ${quantum.evidence.noise.drift}`),
|
|
10365
|
+
row('Randomized benchmarks', `volume dim ${quantum.evidence.volume.dim}, heavy ${quantum.evidence.volume.observed} / ${quantum.evidence.volume.total}, mirror ${quantum.evidence.volume.mirror}`),
|
|
10366
|
+
row('Cross-validation', `ideal ${quantum.evidence.cross.ideal}, noisy ${quantum.evidence.cross.noisy}, agree ideal ${quantum.evidence.cross.agreeIdeal}, agree noise ${quantum.evidence.cross.agreeNoise}`),
|
|
10367
|
+
row('Scaling (theorem qubits, theorem register)', `dim ${quantum.evidence.scaling.dim}, depth ${quantum.evidence.scaling.depth}, exact ${quantum.evidence.scaling.exact}, beyond ${quantum.evidence.scaling.beyond}, advantage ${quantum.evidence.scaling.advantage}`),
|
|
10368
|
+
row('Independent verification', `CORS ${quantum.evidence.verify.cors}, origin ${quantum.evidence.verify.origin}, Lean \`${quantum.evidence.verify.lean}\`, hardware ${quantum.evidence.verify.hardware}, algorithm ${quantum.evidence.verify.algorithm}, RSA ${quantum.evidence.verify.rsa}, crypt ${quantum.evidence.verify.crypt}, encrypt ${quantum.evidence.verify.encrypt}`),
|
|
9220
10369
|
'',
|
|
9221
|
-
'
|
|
10370
|
+
'## Recompute',
|
|
10371
|
+
'',
|
|
10372
|
+
'This README is generated from the blueprint at build. `npm test` compiles then writes the paper. `npm run ci` is Lean then test. `npm run ship` deploys.',
|
|
9222
10373
|
'',
|
|
9223
10374
|
'```sh',
|
|
9224
|
-
'
|
|
10375
|
+
'git clone https://github.com/uuidna/qpu && cd qpu',
|
|
10376
|
+
'npm ci',
|
|
10377
|
+
'npm test',
|
|
9225
10378
|
'```',
|
|
9226
10379
|
'',
|
|
9227
|
-
`[](${installCloudflare.qpu})
|
|
10380
|
+
`Run your own: \`npx uuidna-install\` reads Cloudflare \`install.json\`, or [](${installCloudflare.qpu}).`,
|
|
10381
|
+
'',
|
|
10382
|
+
'Learn, in order. Each step teaches one thing and names the invariant to check it against.',
|
|
9228
10383
|
'',
|
|
9229
|
-
|
|
10384
|
+
row('Step', 'Concept', 'Request', 'Expect', 'Invariant', 'Theorem'),
|
|
10385
|
+
row('---', '---', '---', '---', '---', '---'),
|
|
10386
|
+
...qpuLadderOf().map((l) => row(String(l.step), l.concept, `${l.request.method} ${l.request.path} · ${l.request.tool}`, l.expect, l.invariant, `theorem ${l.theorem}`)),
|
|
9230
10387
|
'',
|
|
9231
|
-
'
|
|
10388
|
+
`Boot on hardware. ${qpuInstallManifestOf().hardware.docker}. Raspberry Pi: ${qpuInstallManifestOf().hardware.pi}. The boot's receipt is ${qpuInstallManifestOf().hardware.prove} — ${qpuInstallManifestOf().hardware.receipt}. The seat stays ${qpuSeatOf().seat}: ${qpuSeatOf().doctrine}.`,
|
|
9232
10389
|
'',
|
|
9233
|
-
|
|
10390
|
+
`Integrate in any harness. One computed block, served on initialize as \`install\` and printed here from the same function. URL ${harness.url}. ${harness.auth}.`,
|
|
9234
10391
|
'',
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
`- theorem follow_the_coins : app + coins = app + theory + practice`,
|
|
9239
|
-
`- theorem emerge : coil = faces ∧ theory = practice`,
|
|
9240
|
-
`- theorem coil_efficiency : coil = faces ∧ faces = rays + rays`,
|
|
9241
|
-
`- theorem next_coil : coil * mintOf (bits + coins) = fused + fused`,
|
|
9242
|
-
`- theorem clay : coins * rays = (seed + (mintOf n - coins)) * coins`,
|
|
10392
|
+
row('Harness', 'How', 'File', 'Config'),
|
|
10393
|
+
row('---', '---', '---', '---'),
|
|
10394
|
+
...harness.rows.map((r) => row(`**${r.harness}** (${r.kind})`, r.how, r.file, `\`${typeof r.config === 'string' ? r.config.replace(/\n/g, ' ') : JSON.stringify(r.config)}\``)),
|
|
9243
10395
|
'',
|
|
9244
|
-
'##
|
|
10396
|
+
'## Cite',
|
|
9245
10397
|
'',
|
|
9246
|
-
|
|
10398
|
+
`MLA 8, ${cite.inText}. DOI ${cite.doi}, archive ${cite.archive}, identifier ${cite.identifier}, ORCID ${cite.author.orcid}. when ${cite.when}: the citation names no access date because the DOI is the date. Cite the running quantum circuit and its Lean proof.`,
|
|
9247
10399
|
'',
|
|
9248
|
-
|
|
9249
|
-
`-
|
|
9250
|
-
`- theorem hybrid : coins + seed = n ∧ rays + seed = mintOf n`,
|
|
10400
|
+
...cite.rows.map((r) => `- ${r.works}`),
|
|
10401
|
+
`- ${cite.prior.works}`,
|
|
9251
10402
|
'',
|
|
9252
|
-
|
|
10403
|
+
qpuSeatOf().acronym,
|
|
9253
10404
|
'',
|
|
9254
|
-
|
|
10405
|
+
'## License',
|
|
10406
|
+
'',
|
|
10407
|
+
'CC-BY-NC-ND-4.0. Source `LICENSE`. Copyright Tsvetan Rouschev.',
|
|
9255
10408
|
'',
|
|
9256
|
-
'User guide is docs.inline. Each MCP command has man. tools/list then tools/call.',
|
|
9257
|
-
''
|
|
9258
10409
|
];
|
|
9259
|
-
for (const row of docs.api) {
|
|
9260
|
-
lines.push(`- \`${row.method} ${row.path}\` ${row.name}. ${row.reading}`);
|
|
9261
|
-
}
|
|
9262
|
-
lines.push('', '## Man', '');
|
|
9263
|
-
for (const tool of m.tools) {
|
|
9264
|
-
lines.push(`### ${tool.name}`, '', '```', tool.man.documentation, '```', '');
|
|
9265
|
-
}
|
|
9266
|
-
lines.push('## Efficiency', '', `agent efficiency. Tokens ${efficiency.tokens}. Quantum ${efficiency.quantum.queries} query vs ${efficiency.quantum.vs} classical. Lattice occupied ${efficiency.quantum.lattice.occupied} vacant ${efficiency.quantum.lattice.vacant}.`, '');
|
|
9267
|
-
for (const row of efficiency.rows) {
|
|
9268
|
-
lines.push(`- ${row.door}: ${row.question} read ${row.readTokens} call ${row.callTokens} ratio ${row.ratio}×`);
|
|
9269
|
-
}
|
|
9270
|
-
lines.push('', '## Train', '', '');
|
|
9271
|
-
for (const team of train.teams) {
|
|
9272
|
-
lines.push(`- ${team.name} ${team.path}: ${team.agents.map((a) => a.tool).join(' ')}`);
|
|
9273
|
-
}
|
|
9274
|
-
lines.push('', '## Sandbox', '', `Unlocked in memory. Morph at call-time. listed false. Ops ${sandbox.ops.join(' ')}. Forged ${sandbox.tools.length}.`, '', '## Improve', '', `next = fused + fused. Winner ${improve.winner}. Before ${improve.before.throughoutput} after ${improve.after.throughoutput}.`, '', '## Compete', '', `Unlocked quantum. next = fused + fused. Winner ${compete.winner}.`, '');
|
|
9275
|
-
for (const team of compete.teams) {
|
|
9276
|
-
lines.push(`- ${team.name} ${team.path}: throughoutput ${team.throughoutput} tokens ${team.tokens} throughput ${team.throughput}`);
|
|
9277
|
-
}
|
|
9278
|
-
lines.push('', '## Prove', '', '', '## Message', '', '', '## Storage', '', `theorem raid. theorem hybrid. theorem next_coil. RAID at ${unit.origin}/storage. Native Alpine Linux. musl. busybox. overlayfs. KV upper. R2 lower. KV work. Next is the double. No last k. Last link deleted frees the inode. Start with cheapest and cover all. Hybrid KV plus R2. Speed ${quantum.capacity.hybrid.speed} cost ${quantum.capacity.hybrid.cost}. QPU hybrid storage hosts the Payload database at ${unit.origin}/storage/databases/payload. Unity seed. Remainder none. Types ${quantum.capacity.raid.cover.join(' ')}. Pick ${quantum.capacity.raid.pick.name}. Clouds ${quantum.capacity.raid.clouds.length}. Cluster route ${quantum.capacity.raid.cluster.route} security ${quantum.capacity.raid.cluster.security} speed ${quantum.capacity.raid.cluster.speed}. No auth.`, '', '## Proof', '', `Source \`${lean.src}\`. theorem quantum : fused = faces * mintOf (bits + seed). theorem infinite. theorem distribute.`, '');
|
|
9279
|
-
for (const row of [...lean.rows, ...lean.cover, lean.climb]) {
|
|
9280
|
-
lines.push(`### ${row.heading}`, '', '```lean', row.theorem, '```', '', '$$', row.formula, '$$', '', row.reading, '');
|
|
9281
|
-
}
|
|
9282
|
-
lines.push('## Build', '', `- qpu: ${quantum.host}`, `- cube: vertices ${quantum.cube.vertices} hexbit ${quantum.cube.hexbit} bits ${quantum.cube.bits}`, `- faces: ${quantum.faces.faces} rays ${quantum.faces.rays} coins ${quantum.faces.coins}`, `- fused: ${quantum.fused} next ${quantum.next}`, `- holds: quantum ${quantum.holds} lean ${lean.holds} mcp ${m.holds}`, `- mcp: ${m.tools.map((t) => t.name).join(' ')}`, '', '## Cite', '', `MLA 8. ${cite.inText}. when ${cite.when}. DOI empty.`, '', ...cite.rows.map((r) => r.works), '', '## License', '', 'CC-BY-NC-ND-4.0. Source `LICENSE`. Copyright Tsvetan Rouschev.', '', '```ts', "import { qpuMcpCallOf, qpuMcpOf } from '@uuidna/qpu'", '```', '', '```sh', 'npm test', '```', '');
|
|
9283
10410
|
return `${lines.join('\n')}\n`;
|
|
9284
10411
|
};
|
|
9285
10412
|
export const qpuReadmeHolds = (text = qpuReadmeOf()) => {
|
|
9286
10413
|
const lean = qpuLeanOf();
|
|
9287
10414
|
const mcp = qpuMcpOf();
|
|
9288
|
-
const
|
|
9289
|
-
|
|
10415
|
+
const cite = qpuCiteOf();
|
|
10416
|
+
const headings = ['## Abstract', '## Unit', '## Interface', '## Results', '## Evidence', '## Recompute', '## Cite', '## License'];
|
|
10417
|
+
const order = headings.every((h, i) => i === n - n || text.indexOf(headings[i - seed]) < text.indexOf(h));
|
|
10418
|
+
return (order &&
|
|
10419
|
+
text.startsWith('# QPU\n') &&
|
|
10420
|
+
!text.includes('Host never') &&
|
|
10421
|
+
!text.includes('## Develop') &&
|
|
10422
|
+
!text.includes('## Purpose') &&
|
|
10423
|
+
!text.includes('## Coil') &&
|
|
10424
|
+
!text.includes('## Hybrid') &&
|
|
10425
|
+
!text.includes('## Guide') &&
|
|
10426
|
+
!text.includes('## Tools') &&
|
|
10427
|
+
!text.includes('## Efficiency') &&
|
|
10428
|
+
!text.includes('## Train') &&
|
|
10429
|
+
!text.includes('## Sandbox') &&
|
|
10430
|
+
!text.includes('## Improve') &&
|
|
10431
|
+
!text.includes('## Compete') &&
|
|
10432
|
+
!text.includes('## Storage') &&
|
|
10433
|
+
!text.includes('## Proof') &&
|
|
10434
|
+
!text.includes('## Build') &&
|
|
10435
|
+
!text.includes('## Man') &&
|
|
10436
|
+
!text.includes('## Prove') &&
|
|
10437
|
+
!text.includes('## Message') &&
|
|
10438
|
+
!text.includes('DOI empty') &&
|
|
10439
|
+
!text.includes(qpuDevelopOf().reading) &&
|
|
9290
10440
|
text.includes('API only') &&
|
|
10441
|
+
text.includes('No HTML') &&
|
|
9291
10442
|
text.includes('docs.inline') &&
|
|
9292
10443
|
text.includes('npx uuidna-install') &&
|
|
9293
10444
|
text.includes('deploy.workers.cloudflare.com') &&
|
|
9294
10445
|
text.includes('install.json') &&
|
|
9295
|
-
text.includes('## Coil') &&
|
|
9296
|
-
text.includes('## Hybrid') &&
|
|
9297
|
-
text.includes('## Develop') &&
|
|
9298
|
-
text.indexOf('## Develop') < text.indexOf('## Install') &&
|
|
9299
|
-
qpuDevelopHolds() &&
|
|
9300
|
-
text.includes(qpuDevelopOf().reading) &&
|
|
9301
10446
|
text.includes('This README is generated') &&
|
|
9302
10447
|
text.includes('Do not import uuidna') &&
|
|
9303
10448
|
text.includes('demo is not a test nor a proof') &&
|
|
10449
|
+
text.includes('the blueprint') &&
|
|
10450
|
+
text.includes('the paper') &&
|
|
10451
|
+
text.includes('theorem quantum') &&
|
|
10452
|
+
text.includes('theorem shor') &&
|
|
10453
|
+
text.includes('theorem crypto') &&
|
|
10454
|
+
text.includes('theorem temperature') &&
|
|
10455
|
+
text.includes('theorem qubits') &&
|
|
10456
|
+
text.includes('Theorems are qpu_lean') &&
|
|
10457
|
+
text.includes(`${shorFactorOf()}`) &&
|
|
10458
|
+
text.includes('Unlocked') &&
|
|
10459
|
+
text.includes('crypto_rsa') &&
|
|
10460
|
+
text.includes('crypto_split') &&
|
|
10461
|
+
text.includes('theorem infinite') &&
|
|
10462
|
+
text.includes('theorem distribute') &&
|
|
9304
10463
|
text.includes('LHC running') &&
|
|
9305
|
-
text.includes('
|
|
9306
|
-
text.includes('theorem hybrid') &&
|
|
9307
|
-
text.includes('QPU hybrid storage hosts the Payload database') &&
|
|
9308
|
-
text.includes('Unity seed') &&
|
|
9309
|
-
text.includes('Remainder none') &&
|
|
9310
|
-
text.includes('Native Alpine Linux') &&
|
|
9311
|
-
text.includes('Last link deleted frees the inode') &&
|
|
9312
|
-
text.includes('Next is the double') &&
|
|
9313
|
-
text.includes('No last k') &&
|
|
9314
|
-
text.includes('theorem two_coins_make_a_coil') &&
|
|
9315
|
-
text.includes('theorem electronics') &&
|
|
9316
|
-
text.includes('theorem coins_balance_theory_in_practice') &&
|
|
9317
|
-
text.includes('theorem follow_the_coins') &&
|
|
9318
|
-
text.includes('theorem emerge') &&
|
|
9319
|
-
text.includes('theorem coil_efficiency') &&
|
|
9320
|
-
text.includes('theorem next_coil') &&
|
|
9321
|
-
text.includes('theorem clay') &&
|
|
9322
|
-
text.includes('2×7 coins = 1+6 coils = clay') &&
|
|
9323
|
-
text.includes('agent efficiency') &&
|
|
9324
|
-
text.includes('qpu_quantum') &&
|
|
9325
|
-
text.includes('qpu_lean') &&
|
|
9326
|
-
text.includes('qpu_cite') &&
|
|
9327
|
-
text.includes('qpu_train') &&
|
|
9328
|
-
text.includes('qpu_forge') &&
|
|
9329
|
-
text.includes('qpu_improve') &&
|
|
9330
|
-
text.includes('qpu_compete') &&
|
|
9331
|
-
text.includes('qpu_prove') &&
|
|
9332
|
-
text.includes('throughoutput') &&
|
|
9333
|
-
text.includes('Unlocked in memory') &&
|
|
9334
|
-
text.includes('VM scaling online') &&
|
|
9335
|
-
text.includes('Coordinated dry-clean') &&
|
|
9336
|
-
text.includes('Lattice flow domains') &&
|
|
10464
|
+
text.includes('opendata.cern.ch') &&
|
|
9337
10465
|
text.includes('Not a ninth sealed tool') &&
|
|
9338
10466
|
text.includes('No auth') &&
|
|
9339
|
-
text.includes('Lean proof') &&
|
|
9340
10467
|
text.includes('JSON-LD') &&
|
|
9341
|
-
text.includes('fourteen schemas') &&
|
|
9342
10468
|
text.includes('schema.org') &&
|
|
9343
|
-
text.includes('theorem shor') &&
|
|
9344
|
-
text.includes('## Purpose') &&
|
|
9345
|
-
text.includes('Nature. Superconducting fridge') &&
|
|
9346
|
-
text.includes('Cybersecurity. Shor N') &&
|
|
9347
|
-
text.includes('Optimization. next = fused + fused') &&
|
|
9348
|
-
text.includes('Science. Lean') &&
|
|
9349
|
-
text.includes('Sensing. Message') &&
|
|
9350
|
-
text.includes('## Evidence') &&
|
|
9351
|
-
text.includes('Execution provenance') &&
|
|
9352
|
-
text.includes('Device-specific noise') &&
|
|
9353
|
-
text.includes('Randomized benchmarks') &&
|
|
9354
|
-
text.includes('Cross-validation') &&
|
|
9355
|
-
text.includes('Scaling beyond exact simulation') &&
|
|
9356
|
-
text.includes('Independent verification') &&
|
|
9357
|
-
text.includes('Fault tolerance') &&
|
|
9358
|
-
text.includes('Public quantum API') &&
|
|
9359
10469
|
text.includes('Possible only in quantum') &&
|
|
9360
10470
|
text.includes('Running quantum circuit') &&
|
|
10471
|
+
text.includes('next is fused + fused') &&
|
|
9361
10472
|
text.includes('/message') &&
|
|
9362
10473
|
text.includes('CC-BY-NC-ND-4.0') &&
|
|
9363
10474
|
text.includes('LICENSE') &&
|
|
9364
|
-
text.includes(
|
|
9365
|
-
text.includes(
|
|
9366
|
-
text.includes(
|
|
9367
|
-
text.includes(
|
|
9368
|
-
text.includes(
|
|
9369
|
-
text.includes(
|
|
9370
|
-
|
|
9371
|
-
text.includes(
|
|
9372
|
-
text.includes(
|
|
9373
|
-
text.includes('theorem infinite') &&
|
|
9374
|
-
text.includes('theorem distribute') &&
|
|
9375
|
-
text.includes('Start with cheapest and cover all') &&
|
|
9376
|
-
text.includes('/storage') &&
|
|
9377
|
-
text.includes('Unlocked quantum') &&
|
|
9378
|
-
text.includes('next = fused + fused') &&
|
|
9379
|
-
text.includes('Capacity infinite') &&
|
|
9380
|
-
text.includes('Live CERN Open Data APIs') &&
|
|
9381
|
-
text.includes('opendata.cern.ch') &&
|
|
9382
|
-
mcp.tools.every((t) => text.includes(t.man.documentation)) &&
|
|
9383
|
-
efficiency.rows.every((r) => text.includes(r.door) && text.includes(r.question)) &&
|
|
10475
|
+
text.includes(cite.author.orcid) &&
|
|
10476
|
+
text.includes(cite.doi) &&
|
|
10477
|
+
text.includes(cite.identifier) &&
|
|
10478
|
+
text.includes(cite.prior.works) &&
|
|
10479
|
+
text.includes(lean.src) &&
|
|
10480
|
+
text.includes(unit.fuse.src) &&
|
|
10481
|
+
qpuDevelopHolds() &&
|
|
10482
|
+
mcp.tools.every((t) => text.includes(t.name) && text.includes(t.man.description)) &&
|
|
10483
|
+
mcp.cybersecurity.tools.every((t) => text.includes(t.name) && text.includes(t.man.description)) &&
|
|
9384
10484
|
mcp.prove.src === lean.src &&
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
10485
|
+
cite.rows.every((r) => text.includes(r.works)) &&
|
|
10486
|
+
qpuDocsOf().api.every((row) => text.includes(`\`${row.method} ${row.path}\``)));
|
|
10487
|
+
};
|
|
10488
|
+
/** SERVED ONCE PER ISOLATE. The unit is deterministic — no clock, no random, no request-dependent state in these
|
|
10489
|
+
* documents — so a document computed once is the document for the life of the isolate. Before this, every request
|
|
10490
|
+
* paid the whole integrity check (about 34 ms) and rebuilt its document (up to 60 ms); on a metered host that is
|
|
10491
|
+
* CPU billed for nothing new. The memo holds the serialized bytes and their fold, and the fold is the ETag, so a
|
|
10492
|
+
* client that already has the document gets a 304 and no body. The tool-call memo holds pure tools only — the
|
|
10493
|
+
* eight cybersecurity tools and the sealed readers — never the sandbox, storage, network, server or a live call,
|
|
10494
|
+
* and never more than the cap, evicting the oldest. Correctness is proved by the suite: the memoized bytes equal a
|
|
10495
|
+
* fresh construction, and by CI: the host serves this build's bytes. */
|
|
10496
|
+
const integrityMemo = { checked: false, holds: false };
|
|
10497
|
+
const integrityOnceOf = () => {
|
|
10498
|
+
if (!integrityMemo.checked) {
|
|
10499
|
+
integrityMemo.holds = qpuIntegrityHolds();
|
|
10500
|
+
integrityMemo.checked = true;
|
|
10501
|
+
}
|
|
10502
|
+
return integrityMemo.holds;
|
|
10503
|
+
};
|
|
10504
|
+
const servedMemo = new Map();
|
|
10505
|
+
const servedCap = mintOf(mintOf(n));
|
|
10506
|
+
const SERVED = [];
|
|
10507
|
+
export const qpuServedLedgerOf = () => SERVED;
|
|
10508
|
+
const servedOf = (key, build) => {
|
|
10509
|
+
const hit = servedMemo.get(key);
|
|
10510
|
+
if (hit) {
|
|
10511
|
+
SERVED.push({ key, fold: hit.etag });
|
|
10512
|
+
return hit;
|
|
10513
|
+
}
|
|
10514
|
+
const body = JSON.stringify(build());
|
|
10515
|
+
const row = { body, etag: `"${qpuFoldOf(body)}"` };
|
|
10516
|
+
if (servedMemo.size >= servedCap)
|
|
10517
|
+
servedMemo.delete(servedMemo.keys().next().value);
|
|
10518
|
+
servedMemo.set(key, row);
|
|
10519
|
+
return row;
|
|
10520
|
+
};
|
|
10521
|
+
/** Pure tools: the four readers and the eight cybersecurity tools reply the same to the same arguments for the life of
|
|
10522
|
+
* the isolate. train, improve and compete climb an occupancy that moves with each call, and forge seats a sandbox;
|
|
10523
|
+
* those are never served from the memo. */
|
|
10524
|
+
const pureTools = new Set(['qpu_quantum', 'qpu_lean', 'qpu_cite', 'qpu_prove', ...cryptoToolNames]);
|
|
10525
|
+
const pureArgs = (args) => Object.keys(args).every((k) => k === 'man' || k === 'n' || k === 'a');
|
|
10526
|
+
export const qpuServedMemoOf = () => ({ entries: servedMemo.size, cap: servedCap, served: SERVED.length, integrity: { ...integrityMemo } });
|
|
10527
|
+
export const qpuServedMemoHolds = (m = qpuServedMemoOf()) => m.entries <= m.cap && m.served >= n - n && (m.integrity.checked ? m.integrity.holds : true);
|
|
10528
|
+
/** Every served row names a memo key and carries a quoted 16-hex fold — the ETag of the bytes served. */
|
|
10529
|
+
export const qpuServedLedgerHolds = (rows = qpuServedLedgerOf()) => rows.every((r) => r.key.length > n - n && /^"[0-9a-f]{16}"$/.test(r.fold));
|
|
10530
|
+
const worker = {
|
|
9393
10531
|
async fetch(request, env) {
|
|
9394
10532
|
const host = env?.QPU_HOST ?? unit.host;
|
|
9395
|
-
|
|
9396
|
-
|
|
10533
|
+
// THE SEAT RIDES ON THE ANSWER (the captain, 2026-09-13: the unit is a router of referrers). Set once the path
|
|
10534
|
+
// is known, below; every response then carries where it was computed and which door answered, so a caller can
|
|
10535
|
+
// see the decision instead of taking it on trust. Empty until then, which is the honest reading before a path.
|
|
10536
|
+
let routeHeaders = {};
|
|
10537
|
+
const jsonOf = (body, status = found) => new Response(JSON.stringify(body), { status, headers: { ...headers, ...routeHeaders } });
|
|
10538
|
+
/** A memoized document: 304 with no body when the client's If-None-Match is its ETag, else the bytes with the ETag. */
|
|
10539
|
+
const servedResponse = (row) => {
|
|
10540
|
+
if (request.headers.get('if-none-match') === row.etag)
|
|
10541
|
+
return new Response(null, { status: found + ten * ten + mintOf(coins), headers: { ...headers, ...routeHeaders, etag: row.etag } });
|
|
10542
|
+
return new Response(row.body, { status: found, headers: { ...headers, ...routeHeaders, etag: row.etag } });
|
|
10543
|
+
};
|
|
10544
|
+
if (host !== unit.host || host.includes('*') || !unit.holds || !integrityOnceOf()) {
|
|
9397
10545
|
return jsonOf(JSON.parse(dead), lost);
|
|
9398
10546
|
}
|
|
9399
10547
|
const url = new URL(request.url);
|
|
9400
10548
|
const raw = url.pathname.replace(/\/$/, '') || '/';
|
|
9401
10549
|
const path = raw === '/index.html' ? '/' : raw;
|
|
10550
|
+
const route = qpuRouterOf(request.headers.get('referer') ?? '', path);
|
|
10551
|
+
routeHeaders = { 'x-qpu-seat': route.seat, 'x-qpu-door': route.door };
|
|
9402
10552
|
const named = url.protocol === 'https:' && url.hostname === unit.host;
|
|
9403
10553
|
if (!named)
|
|
9404
10554
|
return jsonOf(JSON.parse(dead), lost);
|
|
9405
10555
|
if (request.method === 'OPTIONS')
|
|
9406
10556
|
return new Response(null, { status: found + coins + coins, headers });
|
|
9407
10557
|
if (path === '/mcp') {
|
|
10558
|
+
// STREAMABLE HTTP, HONESTLY (measured 2026-09-12): this unit answers every JSON-RPC request in its POST and opens no
|
|
10559
|
+
// server-initiated stream, so a GET asking for text/event-stream gets the spec's other allowed answer — 405 with
|
|
10560
|
+
// Allow — and the client falls back to POST instead of parsing a JSON-LD catalog as an event stream.
|
|
10561
|
+
if (request.method === 'GET' && (request.headers.get('accept') ?? '').includes('text/event-stream')) {
|
|
10562
|
+
return new Response(null, { status: lost + seed, headers: { ...headers, allow: 'POST, OPTIONS' } });
|
|
10563
|
+
}
|
|
9408
10564
|
if (request.method === 'POST') {
|
|
9409
|
-
|
|
10565
|
+
let parsed;
|
|
10566
|
+
try {
|
|
10567
|
+
parsed = JSON.parse(await request.text());
|
|
10568
|
+
}
|
|
10569
|
+
catch {
|
|
10570
|
+
return jsonOf(rpcErrorOf(null, rpcCodes.parse, 'Parse error: the body is not JSON'), badRequest);
|
|
10571
|
+
}
|
|
10572
|
+
if (Array.isArray(parsed)) {
|
|
10573
|
+
// JSON-RPC BATCH. MCP 2025-03-26 allowed batches and 2025-06-18 removed them; a server advertising both accepts
|
|
10574
|
+
// them. Every member is re-dispatched through this same door, so a batch is exactly its members; a notification
|
|
10575
|
+
// (no id) gets no entry, per JSON-RPC 2.0; an empty array is the spec's Invalid Request.
|
|
10576
|
+
const members = parsed;
|
|
10577
|
+
if (members.length === n - n || !members.every((m) => m !== null && typeof m === 'object' && !Array.isArray(m)))
|
|
10578
|
+
return jsonOf(rpcErrorOf(null, rpcCodes.invalid, 'Invalid Request: a batch must be a non-empty array of request objects'), badRequest);
|
|
10579
|
+
const auth = request.headers.get('authorization');
|
|
10580
|
+
const replies = await Promise.all(members.map(async (m) => {
|
|
10581
|
+
const one = new Request(request.url, { method: 'POST', headers: { 'content-type': 'application/json', accept: 'application/json', ...(auth ? { authorization: auth } : {}) }, body: JSON.stringify(m) });
|
|
10582
|
+
const r = await worker.fetch(one, env);
|
|
10583
|
+
return m.id === undefined ? null : (await r.json());
|
|
10584
|
+
}));
|
|
10585
|
+
return jsonOf(replies.filter((r) => r !== null));
|
|
10586
|
+
}
|
|
10587
|
+
if (parsed === null || typeof parsed !== 'object') {
|
|
10588
|
+
return jsonOf(rpcErrorOf(null, rpcCodes.invalid, 'Invalid Request: expected one JSON-RPC 2.0 request object'), badRequest);
|
|
10589
|
+
}
|
|
10590
|
+
const body = parsed;
|
|
10591
|
+
if (typeof body.method !== 'string') {
|
|
10592
|
+
return jsonOf(rpcErrorOf(body.id, rpcCodes.invalid, 'Invalid Request: method must be a string'), badRequest);
|
|
10593
|
+
}
|
|
9410
10594
|
if (body.method === 'initialize' || body.method === 'server/discover') {
|
|
9411
|
-
return jsonOf({ jsonrpc: '2.0', id: body.id ?? null, result: qpuMcpDiscoverOf() });
|
|
10595
|
+
return jsonOf({ jsonrpc: '2.0', id: body.id ?? null, result: qpuMcpDiscoverOf(body.params?.protocolVersion) });
|
|
9412
10596
|
}
|
|
9413
10597
|
if (body.method === 'ping' || body.method === 'notifications/initialized') {
|
|
9414
10598
|
return jsonOf({ jsonrpc: '2.0', id: body.id ?? null, result: {} });
|
|
9415
10599
|
}
|
|
10600
|
+
/** The envelope carries the request's id, so the memo holds the result's bytes and the envelope is spliced around
|
|
10601
|
+
* them — the same bytes JSON.stringify would produce for the whole object. */
|
|
10602
|
+
const envelope = (id, resultBody) => new Response(`{"jsonrpc":"2.0","id":${JSON.stringify(id ?? null)},"result":${resultBody}}`, { status: found, headers });
|
|
9416
10603
|
if (body.method === 'tools/list') {
|
|
9417
|
-
|
|
9418
|
-
return jsonOf({ jsonrpc: '2.0', id: body.id ?? null, result: { resultType: 'complete', tools: sealed } });
|
|
10604
|
+
return envelope(body.id, servedOf('tools/list', () => ({ resultType: 'complete', tools: qpuMcpToolsListOf() })).body);
|
|
9419
10605
|
}
|
|
9420
10606
|
if (body.method === 'tools/call') {
|
|
9421
|
-
const name = body.params?.name
|
|
9422
|
-
|
|
10607
|
+
const name = typeof body.params?.name === 'string' ? body.params.name : '';
|
|
10608
|
+
const args = body.params?.arguments && typeof body.params.arguments === 'object' && !Array.isArray(body.params.arguments) ? body.params.arguments : {};
|
|
10609
|
+
if (pureTools.has(name) && pureArgs(args)) {
|
|
10610
|
+
const key = `call:${name}:${JSON.stringify(args)}`;
|
|
10611
|
+
const hit = servedMemo.get(key);
|
|
10612
|
+
if (hit) {
|
|
10613
|
+
SERVED.push({ key, fold: hit.etag });
|
|
10614
|
+
return envelope(body.id, hit.body);
|
|
10615
|
+
}
|
|
10616
|
+
const called = await qpuMcpCallOf(name, args, env, request.headers.get('authorization'));
|
|
10617
|
+
if (isUnknownTool(called))
|
|
10618
|
+
return jsonOf(rpcErrorOf(body.id, rpcCodes.params, `Unknown tool: ${name || '(none)'}`, { tools: called.tools }));
|
|
10619
|
+
return envelope(body.id, servedOf(key, () => called).body);
|
|
10620
|
+
}
|
|
10621
|
+
const called = await qpuMcpCallOf(name, args, env, request.headers.get('authorization'));
|
|
10622
|
+
if (isUnknownTool(called))
|
|
10623
|
+
return jsonOf(rpcErrorOf(body.id, rpcCodes.params, `Unknown tool: ${name || '(none)'}`, { tools: called.tools }));
|
|
10624
|
+
return jsonOf({ jsonrpc: '2.0', id: body.id ?? null, result: called });
|
|
9423
10625
|
}
|
|
9424
|
-
return jsonOf(
|
|
10626
|
+
return jsonOf(rpcErrorOf(body.id, rpcCodes.method, `Method not found: ${body.method}`, { methods: [...rpcMethods] }));
|
|
9425
10627
|
}
|
|
9426
|
-
return
|
|
10628
|
+
return servedResponse(servedOf('/mcp', () => qpuMcpOf()));
|
|
10629
|
+
}
|
|
10630
|
+
if (path === `/${unit.fuse.lean}`) {
|
|
10631
|
+
return new Response(leanSource, { status: found, headers: { ...headers, 'content-type': 'text/plain; charset=utf-8' } });
|
|
9427
10632
|
}
|
|
9428
10633
|
if (path === '/')
|
|
9429
|
-
return
|
|
10634
|
+
return servedResponse(servedOf('/', () => qpuQuantumOf()));
|
|
9430
10635
|
if (path === `/${unit.path}`)
|
|
9431
|
-
return
|
|
10636
|
+
return servedResponse(servedOf(`/${unit.path}`, () => qpuLeanOf()));
|
|
9432
10637
|
if (path === '/cite')
|
|
9433
|
-
return
|
|
10638
|
+
return servedResponse(servedOf('/cite', () => qpuCiteOf()));
|
|
10639
|
+
// DISCOVERY DOORS — extras off the seven-path guide (the README names extras as allowed). What an MCP client, a
|
|
10640
|
+
// registry, an OpenAPI consumer or a crawler asks for by convention, each derived from the readings above. Measured
|
|
10641
|
+
// 2026-09-12: all five answered 404 while the README promised install.json.
|
|
10642
|
+
if (path === '/.well-known/mcp.json')
|
|
10643
|
+
return servedResponse(servedOf(path, () => qpuWellKnownOf()));
|
|
10644
|
+
if (path === '/mcp.json')
|
|
10645
|
+
return servedResponse(servedOf(path, () => qpuMcpOf()));
|
|
10646
|
+
if (path === '/install.json')
|
|
10647
|
+
return servedResponse(servedOf(path, () => qpuInstallManifestOf()));
|
|
10648
|
+
if (path === '/openapi.json')
|
|
10649
|
+
return servedResponse(servedOf(path, () => qpuOpenApiOf()));
|
|
10650
|
+
if (path === '/sitemap.xml')
|
|
10651
|
+
return new Response(qpuSitemapOf(), { status: found, headers: { ...headers, 'content-type': 'application/xml; charset=utf-8' } });
|
|
9434
10652
|
if (path === '/server' || path.startsWith('/server/')) {
|
|
9435
10653
|
if (request.method === 'POST') {
|
|
9436
10654
|
const body = (await request.json().catch(() => ({})));
|
|
@@ -9442,7 +10660,9 @@ export default {
|
|
|
9442
10660
|
if (path.startsWith('/server/') && path.length > '/server/'.length) {
|
|
9443
10661
|
const id = Number(path.slice('/server/'.length));
|
|
9444
10662
|
const job = serverJobs.find((row) => row.id === id);
|
|
9445
|
-
|
|
10663
|
+
if (job)
|
|
10664
|
+
return jsonOf({ ...job, stored: false });
|
|
10665
|
+
return jsonOf({ kind: 'result', id, holds: false, denied: 'job', why: 'jobs are not stored; the result is returned inline with the submit, and an id lives only as long as the isolate that ran it' }, lost);
|
|
9446
10666
|
}
|
|
9447
10667
|
return jsonOf(qpuServerMcpOf());
|
|
9448
10668
|
}
|
|
@@ -9461,20 +10681,26 @@ export default {
|
|
|
9461
10681
|
const key = path === '/storage' ? '' : decodeURIComponent(path.slice('/storage/'.length));
|
|
9462
10682
|
if (request.method === 'POST' && path === '/storage') {
|
|
9463
10683
|
const body = (await request.json().catch(() => ({})));
|
|
9464
|
-
const
|
|
10684
|
+
const auth = request.headers.get('authorization');
|
|
10685
|
+
const rpc = await qpuSubRpcOf(body, qpuStorageToolsOf(env, auth), storageHref);
|
|
9465
10686
|
if (rpc)
|
|
9466
10687
|
return jsonOf(rpc);
|
|
9467
10688
|
if (body.maintain === true)
|
|
9468
10689
|
return jsonOf(await qpuStorageMaintainOf(env));
|
|
9469
|
-
if (typeof body.key === 'string')
|
|
9470
|
-
|
|
10690
|
+
if (typeof body.key === 'string') {
|
|
10691
|
+
const put = await qpuStorageOf(env, { method: 'PUT', key: body.key, value: body.value, auth });
|
|
10692
|
+
return jsonOf(put, put.holds === false && 'denied' in put && put.denied === 'auth' ? unauthorized : found);
|
|
10693
|
+
}
|
|
9471
10694
|
}
|
|
9472
10695
|
if (request.method === 'PUT' || request.method === 'POST') {
|
|
9473
10696
|
const value = await request.json().catch(() => null);
|
|
9474
|
-
|
|
10697
|
+
const put = await qpuStorageOf(env, { method: 'PUT', key, value, auth: request.headers.get('authorization') });
|
|
10698
|
+
return jsonOf(put, put.holds === false && 'denied' in put && put.denied === 'auth' ? unauthorized : found);
|
|
10699
|
+
}
|
|
10700
|
+
if (request.method === 'DELETE') {
|
|
10701
|
+
const del = await qpuStorageOf(env, { method: 'DELETE', key, auth: request.headers.get('authorization') });
|
|
10702
|
+
return jsonOf(del, del.holds === false && 'denied' in del && del.denied === 'auth' ? unauthorized : found);
|
|
9475
10703
|
}
|
|
9476
|
-
if (request.method === 'DELETE')
|
|
9477
|
-
return jsonOf(await qpuStorageOf(env, { method: 'DELETE', key }));
|
|
9478
10704
|
if (path === '/storage')
|
|
9479
10705
|
return jsonOf(await qpuStorageMcpOf(env));
|
|
9480
10706
|
return jsonOf(await qpuStorageOf(env, { method: 'GET', key }));
|
|
@@ -9490,3 +10716,4 @@ export default {
|
|
|
9490
10716
|
return jsonOf(JSON.parse(dead), lost);
|
|
9491
10717
|
}
|
|
9492
10718
|
};
|
|
10719
|
+
export default worker;
|