diff --git a/.github/workflows/studio.yml b/.github/workflows/studio.yml index c08dc88c..5f2eff00 100644 --- a/.github/workflows/studio.yml +++ b/.github/workflows/studio.yml @@ -304,7 +304,7 @@ jobs: node tools/live_proof.mjs --check export PATH="$HOME/.elan/bin:$PATH" cd proof && lake build && lake env lean PrismLive/Axioms.lean | tee axioms.txt - test "$(grep -c 'depends on axioms: \[propext, Quot.sound\]' axioms.txt)" = 3 + test "$(grep -c 'depends on axioms: \[propext, Quot.sound\]' axioms.txt)" = 4 # The exporter is fixed by the commit shell/kernel/lean/manifest.json names, built with the toolchain # studio/proof pins: those two are everything the cached binary depends on. - name: Cache the Lean exporter the in-tab library is written with diff --git a/CONFORMANCE.md b/CONFORMANCE.md index a9ef6f65..3e9bd2a4 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -320,6 +320,12 @@ model does not sanction. | --- | --- | --- | | `FA-83` | `build` | Stateful preview parsing and checking transmit source only under disclosed source-bound or turn-scoped revocable hosted permission | +## in-tab-is-not-guarantee + +| ID | Level | Statement | +| --- | --- | --- | +| `FA-91` | `build` | A guarantee whose conditions say is not or != is proved in the tab when it holds: Lean's kernel proves it below and above the value and joins the two with a lemma it checks | + ## in-tab-kernel-verdict | ID | Level | Statement | diff --git a/app/product.json b/app/product.json index 255445a8..9ac8d77b 100644 --- a/app/product.json +++ b/app/product.json @@ -829,6 +829,7 @@ "text": "A verdict is decided by the guest from what the tab derived, Lean's kernel in the tab judges every theorem with no server, and local obligations hold on every request.", "ids": [ "FA-86", + "FA-91", "LL-01", "LL-02" ], diff --git a/app/src/Features.lex.tex b/app/src/Features.lex.tex index 826beb28..939c2033 100644 --- a/app/src/Features.lex.tex +++ b/app/src/Features.lex.tex @@ -1226,6 +1226,13 @@ body: "crates/conformance/tests/in_tab_kernel_verdict.rs::in_tab_kernel_verdict_fa_86" } +definition{ + name: testFA91, + parameters: [], + result: String, + body: "crates/conformance/tests/in_tab_kernel_verdict.rs::in_tab_is_not_guarantee_fa_91" +} + definition{ name: testLL01, parameters: [], @@ -1629,7 +1636,7 @@ name: featureProof, parameters: [], result: Foundation.Arch::Feature, - body: (record Foundation.Arch::Feature {statement := "Proof (FA-86, LL-01, LL-02): A verdict is decided by the guest from what the tab derived, Lean's kernel in the tab judges every theorem with no server, and local obligations hold on every request.", calls := (cons "InTabKernel::verdictCode" (cons "InTabKernelProtocol::dispatchVerdict" (nil String))), acceptance := (cons "Features::testFA86" (cons "Features::testLL01" (cons "Features::testLL02" (nil String))))}) + body: (record Foundation.Arch::Feature {statement := "Proof (FA-86, FA-91, LL-01, LL-02): A verdict is decided by the guest from what the tab derived, Lean's kernel in the tab judges every theorem with no server, and local obligations hold on every request.", calls := (cons "InTabKernel::verdictCode" (cons "InTabKernelProtocol::dispatchVerdict" (nil String))), acceptance := (cons "Features::testFA86" (cons "Features::testFA91" (cons "Features::testLL01" (cons "Features::testLL02" (nil String)))))}) } definition{ diff --git a/crates/conformance/tests/in_tab_kernel_verdict.rs b/crates/conformance/tests/in_tab_kernel_verdict.rs index 24264614..cc9b4fdc 100644 --- a/crates/conformance/tests/in_tab_kernel_verdict.rs +++ b/crates/conformance/tests/in_tab_kernel_verdict.rs @@ -23,8 +23,8 @@ fn in_tab_kernel_verdict_fa_86() { ); // A run that skipped, filtered or lost a test is not the oracle. for required in [ - "# tests 7", - "# pass 7", + "# tests 8", + "# pass 8", "# fail 0", "# cancelled 0", "# skipped 0", @@ -53,3 +53,33 @@ fn rule_judge_fa_90() { assert_eq!(theorems, vectors); assert!(theorems >= 9); } + +/// `FA-91`: A guarantee whose conditions say is not or != is proved in the tab when it holds: Lean's kernel proves it below and above the value and joins the two with a lemma it checks +#[test] +fn in_tab_is_not_guarantee_fa_91() { + // The suite runs prism.prove as the studio runs it, with the shipped Lean kernel and library and the pinned + // guest; FA-86's test above reads the same report and holds the counts. + let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .ancestors() + .nth(2) + .expect("repository root") + .to_path_buf(); + let output = Command::new("node") + .args(["--test", "--test-reporter=tap"]) + .arg(root.join("studio/tools/in_tab_kernel_verdict.test.mjs")) + .output() + .expect("the locked SDK supplies Node"); + let report = String::from_utf8_lossy(&output.stdout); + assert!( + output.status.success(), + "{report}\n{}", + String::from_utf8_lossy(&output.stderr) + ); + assert!( + report.lines().any(|line| line + == "ok 8 - a guarantee that says is not is proved when it holds, below and above the value, and refused when it does not"), + "the is-not guarantee test did not pass: {report}" + ); + let regions = include_str!("../../../studio/proof/PrismLive/Regions.lean"); + assert!(regions.contains("theorem ruleHolds_split")); +} diff --git a/crates/conformance/tests/live_lexlean.rs b/crates/conformance/tests/live_lexlean.rs index 9fb5178f..2812fc48 100644 --- a/crates/conformance/tests/live_lexlean.rs +++ b/crates/conformance/tests/live_lexlean.rs @@ -20,7 +20,7 @@ fn read(path: &str) -> String { } /// The studio workflow builds the proofs and refuses any axiom beyond propext and -/// Quot.sound for all three theorems, so the claim is checked where it is made. +/// Quot.sound for all four theorems, so the claim is checked where it is made. fn built_and_axioms_checked(theorem: &str) { let workflow = read(".github/workflows/studio.yml"); assert!( @@ -28,8 +28,8 @@ fn built_and_axioms_checked(theorem: &str) { "the studio workflow no longer builds the proofs and prints their axioms" ); assert!( - workflow.contains(r#"depends on axioms: \[propext, Quot.sound\]' axioms.txt)" = 3"#), - "the studio workflow no longer requires exactly propext and Quot.sound of all three theorems" + workflow.contains(r#"depends on axioms: \[propext, Quot.sound\]' axioms.txt)" = 4"#), + "the studio workflow no longer requires exactly propext and Quot.sound of all four theorems" ); let axioms = read("studio/proof/PrismLive/Axioms.lean"); assert!( diff --git a/features/suites/in-tab-is-not-guarantee.feature b/features/suites/in-tab-is-not-guarantee.feature new file mode 100644 index 00000000..6bb085b8 --- /dev/null +++ b/features/suites/in-tab-is-not-guarantee.feature @@ -0,0 +1,9 @@ +Feature: in-tab-is-not-guarantee + + @FA-91 @build + Scenario: A guarantee whose conditions say is not or != is proved in the tab when it holds: Lean's kernel proves it below and above the value and joins the two with a lemma it checks + Given the parking-fee fixture, whose fourth guarantee is always premium over eight hours unless the vehicle is a motorcycle + When prism.prove proves it in this process with the shipped Lean kernel and library and the pinned guest + Then every guarantee is proved and the guest says proved, on propext and Quot.sound + And the same guarantee for every vehicle but a car, which a motorcycle breaks, is refused and named + And ruleHolds_split, proved in studio/proof, joins the halves, and the kernel refuses a join with the wrong value diff --git a/model/ids.toml b/model/ids.toml index 638daeff..e1a4931e 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -867,3 +867,9 @@ id = "FA-90" level = "build" suite = "rule-judge" statement = "A published app's answer is decided by the rule judge in Foundry's Prism kernel: the first rule whose conditions all hold decides, otherwise decides when none does, and a request outside the fields' bounds is refused" + +[[id]] +id = "FA-91" +level = "build" +suite = "in-tab-is-not-guarantee" +statement = "A guarantee whose conditions say is not or != is proved in the tab when it holds: Lean's kernel proves it below and above the value and joins the two with a lemma it checks" diff --git a/studio/proof/PrismLive/Axioms.lean b/studio/proof/PrismLive/Axioms.lean index c6411c16..5312f0c0 100644 --- a/studio/proof/PrismLive/Axioms.lean +++ b/studio/proof/PrismLive/Axioms.lean @@ -5,3 +5,4 @@ import PrismLive.VerdantRegions #print axioms PrismLive.Kernel.regionCheck_sound #print axioms VerdantR.all_hold #print axioms PrismLive.Kernel.ruleJudge_sound +#print axioms PrismLive.Kernel.ruleHolds_split diff --git a/studio/proof/PrismLive/Regions.lean b/studio/proof/PrismLive/Regions.lean index 0c77583b..4ce72dc1 100644 --- a/studio/proof/PrismLive/Regions.lean +++ b/studio/proof/PrismLive/Regions.lean @@ -739,6 +739,64 @@ theorem ruleJudge_sound (P : List Nat) (p : Property) (hc : wordsCheck P p = tru exact hin exact regionCheck_sound _ _ _ _ hreg p (by simp) x hbox + +/-! ## A guarantee that says `is not` + +`wordsCheck` reads a guarantee's conditions as one box, and a box cannot say `is not` (op 5): it keeps every value of +the field, so a true guarantee such as "always premium when hours > 8 and the vehicle is not a motorcycle" is +checked over motorcycles too, and refused. Such a guarantee is the two guarantees "below the value" and "above it": +a whole number other than `v` is less than `v` or greater. `ruleHolds_split` joins proofs of the two halves into a +proof of the guarantee as written, so each half is checked as a box and nothing is widened. -/ + +/-- The guarantee holds of an app's words: no in-bounds request breaks it (`ruleJudge_sound`'s conclusion). -/ +def RuleHolds (P : List Nat) (p : Property) : Prop := + ∀ x : List Nat, + rulesEnd (P ++ x) (4 + multiply 2 (word (P ++ x) 1)) (word (P ++ x) (3 + multiply 2 (word (P ++ x) 1))) + + word (P ++ x) 1 = (P ++ x).length → + ruleInBounds (P ++ x) 0 (word (P ++ x) 1) + (rulesEnd (P ++ x) (4 + multiply 2 (word (P ++ x) 1)) (word (P ++ x) (3 + multiply 2 (word (P ++ x) 1)))) = true → + breaksWith p x (ruleOutcome (P ++ x) (4 + multiply 2 (word (P ++ x) 1)) + (word (P ++ x) (3 + multiply 2 (word (P ++ x) 1))) (word (P ++ x) (2 + multiply 2 (word (P ++ x) 1))) + (rulesEnd (P ++ x) (4 + multiply 2 (word (P ++ x) 1)) (word (P ++ x) (3 + multiply 2 (word (P ++ x) 1))))) = false + +theorem ruleJudge_holds (P : List Nat) (p : Property) (hc : wordsCheck P p = true) : RuleHolds P p := + fun x hlen hin => ruleJudge_sound P p hc x hlen hin + +theorem allHold_append (x : List Nat) : ∀ (l r : List Cond), allHold (l ++ r) x = (allHold l x && allHold r x) + | [], r => by simp [allHold] + | c :: l, r => by + simp only [List.cons_append, allHold] + split <;> simp [allHold_append x l r] + +/-- A field is not `v` exactly when it is below `v` or above it. -/ +theorem condHolds_ne (f v : Nat) (x : List Nat) : + condHolds ⟨f, 5, v⟩ x = (condHolds ⟨f, 0, v⟩ x || condHolds ⟨f, 2, v⟩ x) := by + simp only [condHolds, opHolds] + by_cases e : get x f = v + · simp [e] + · by_cases l : get x f < v + · simp [e, l] + · have : v < get x f := by omega + simp [e, l, this] + +theorem allHold_ne_split (pre post : List Cond) (f v : Nat) (x : List Nat) : + allHold (pre ++ ⟨f, 5, v⟩ :: post) x = + (allHold (pre ++ ⟨f, 0, v⟩ :: post) x || allHold (pre ++ ⟨f, 2, v⟩ :: post) x) := by + simp only [allHold_append, allHold, condHolds_ne f v x] + cases allHold pre x <;> cases condHolds ⟨f, 0, v⟩ x <;> cases condHolds ⟨f, 2, v⟩ x <;> simp + +/-- A guarantee with `field is not v` holds when it holds below `v` and above `v`. -/ +theorem ruleHolds_split (P : List Nat) (a : Bool) (pre post : List Cond) (f v po : Nat) + (h0 : RuleHolds P ⟨a, pre ++ ⟨f, 0, v⟩ :: post, po⟩) (h2 : RuleHolds P ⟨a, pre ++ ⟨f, 2, v⟩ :: post, po⟩) : + RuleHolds P ⟨a, pre ++ ⟨f, 5, v⟩ :: post, po⟩ := fun x hlen hin => by + have b0 := h0 x hlen hin + have b2 := h2 x hlen hin + rw [breaksWith_eq] at b0 b2 ⊢ + simp only [allHold_ne_split pre post f v x] + simp only [bad] at b0 b2 ⊢ + revert b0 b2 + cases allHold (pre ++ ⟨f, 0, v⟩ :: post) x <;> cases allHold (pre ++ ⟨f, 2, v⟩ :: post) x <;> simp + end PrismLive.Kernel /-! diff --git a/studio/shell/kernel/lean/library.ndjson.gz b/studio/shell/kernel/lean/library.ndjson.gz index 1224157a..841eb44f 100644 Binary files a/studio/shell/kernel/lean/library.ndjson.gz and b/studio/shell/kernel/lean/library.ndjson.gz differ diff --git a/studio/shell/kernel/lean/manifest.json b/studio/shell/kernel/lean/manifest.json index 51c0e8f9..66bdd953 100644 --- a/studio/shell/kernel/lean/manifest.json +++ b/studio/shell/kernel/lean/manifest.json @@ -36,7 +36,10 @@ "Bool.and", "Bool.or", "ite", - "instDecidableEqBool" + "instDecidableEqBool", + "PrismLive.Kernel.ruleJudge_holds", + "PrismLive.Kernel.ruleHolds_split", + "PrismLive.Kernel.RuleHolds" ] }, "glue": { @@ -51,17 +54,17 @@ }, "library": { "file": "library.ndjson.gz", - "sha256": "a22cb8e581310c1c4a03e120e277dd99d37c66f8159188e866f68177836aa560", - "bytes": 7834171 + "sha256": "c124f47e55c23b095ed7650548768456ef48e37d2f3824d8ede735488c1ad6c0", + "bytes": 8111283 }, "binding": { "schema": "prism/in-tab-library-binding/1", "lean": "f054605aea4b840552cca2e725580bffd1e1b704", "kernel": "4b48480b9c03ae4aa3bf1a37256b59bff2d41d6cf452a2f8aa9de41a28ccd118", "loader": "3f482f95c28fb0c74027552d6c4519f8916e48cd1d5b0bd202f318ca8c027a4a", - "library": "a22cb8e581310c1c4a03e120e277dd99d37c66f8159188e866f68177836aa560", - "declarations": 2113, - "sentToTheKernel": 1932, + "library": "c124f47e55c23b095ed7650548768456ef48e37d2f3824d8ede735488c1ad6c0", + "declarations": 2126, + "sentToTheKernel": 1945, "judgedBy": "check_whole, every declaration, in this kernel" } } diff --git a/studio/shell/prism.js b/studio/shell/prism.js index 436f2302..8ef39a78 100644 --- a/studio/shell/prism.js +++ b/studio/shell/prism.js @@ -546,8 +546,27 @@ function leanWorker(self) { const P = declare("def", at + "words", app(C("List", [0]), Nat), list(Nat, words.map(nat))); const p = declare("def", at + "guarantee", C(K + "Property"), app(C(K + "Property.mk"), C(g.always ? "Bool.true" : "Bool.false"), list(C(K + "Cond"), g.when.map(cond)), nat(g.outcome))); const T = C("Bool.true"); - const checked = declare("thm", at + "checked", app(C("Eq", [one]), Bool, app(C(K + "wordsCheck"), P, p), T), app(C("Eq.refl", [one]), Bool, T)); - declare("thm", at + "holds", instantiate(lib.types.get(known(K + "ruleJudge_sound")), [P, p, checked]), app(C(K + "ruleJudge_sound"), P, p, checked)); + const check = (q, tag) => declare("thm", at + "checked" + tag, app(C("Eq", [one]), Bool, app(C(K + "wordsCheck"), P, q), T), app(C("Eq.refl", [one]), Bool, T)); + // A box cannot say `is not` (op 5), so `wordsCheck` would read such a guarantee over every value of the field. + // It is proved below the value and above it instead, each as a box, and `ruleHolds_split` joins the two. + if (!g.when.some(([, op]) => op === 5)) { + const checked = check(p, ""); + declare("thm", at + "holds", instantiate(lib.types.get(known(K + "ruleJudge_sound")), [P, p, checked]), app(C(K + "ruleJudge_sound"), P, p, checked)); + return out.join("\n") + "\n"; + } + const Cond = C(K + "Cond"), always = C(g.always ? "Bool.true" : "Bool.false"), po = nat(g.outcome); + let halves = 0; + const proof = (when) => { + const j = when.findIndex(([, op]) => op === 5); + if (j < 0) { + const tag = "." + halves++, q = declare("def", at + "half" + tag, C(K + "Property"), app(C(K + "Property.mk"), always, list(Cond, when.map(cond)), po)); + return app(C(K + "ruleJudge_holds"), P, q, check(q, tag)); + } + const pre = when.slice(0, j), post = when.slice(j + 1), [f, , v] = when[j]; + return app(C(K + "ruleHolds_split"), P, always, list(Cond, pre.map(cond)), list(Cond, post.map(cond)), nat(f), nat(v), po, + proof([...pre, [f, 0, v], ...post]), proof([...pre, [f, 2, v], ...post])); + }; + declare("thm", at + "holds", app(C(K + "RuleHolds"), P, p), proof(g.when)); return out.join("\n") + "\n"; }; async function open({ manifest, glue, wasm, library }) { diff --git a/studio/tools/in_tab_kernel_verdict.test.mjs b/studio/tools/in_tab_kernel_verdict.test.mjs index 72814dc5..8c10f686 100644 --- a/studio/tools/in_tab_kernel_verdict.test.mjs +++ b/studio/tools/in_tab_kernel_verdict.test.mjs @@ -104,3 +104,37 @@ test('the pinned guest, the bytes the studio runs, answers every vector of the c assert.deepEqual(await verdictWithGuest({ dispatch }, proved.input), { ok: true, code: 0, verdict: 'proved' }); assert.deepEqual(await verdictWithGuest({ dispatch }, { ...structuredClone(proved.input), leanAccepted: 0 }), { ok: true, code: 3, verdict: 'refused' }); }); + +// FA-91. prism.prove, as the studio runs it, in this process: its worker's own source, the shipped Lean kernel and +// library, and the pinned guest. A browser's Worker, blob URLs and file fetch are played by the stand-ins below. +test('a guarantee that says is not is proved when it holds, below and above the value, and refused when it does not', async () => { + const { prove } = await import('../shell/prism.js'); + const parts = new WeakMap(), Native = globalThis.Blob; + globalThis.Blob = class extends Native { constructor(p, o) { super(p, o); parts.set(this, p); } }; + // The worker's source is read back from its URL; the kernel's loader is imported, and under Node it needs a file. + const os = await import('node:os'), path = await import('node:path'), { pathToFileURL } = await import('node:url'); + URL.createObjectURL = (b) => { const bytes = Buffer.concat(parts.get(b).map((p) => Buffer.from(typeof p === 'string' ? p : new Uint8Array(p.buffer ?? p, p.byteOffset ?? 0, p.byteLength)))); if (bytes[0] === 0x28) return 'data:text/javascript;base64,' + bytes.toString('base64'); const f = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'lean-')), 'glue.mjs'); fs.writeFileSync(f, bytes); return pathToFileURL(f).href; }; + URL.revokeObjectURL = () => {}; + const net = globalThis.fetch; + globalThis.fetch = async (u) => (String(u).startsWith('file:') ? new Response(fs.readFileSync(new URL(u))) : net(u)); + globalThis.Worker = class { constructor(url) { const heard = new Set(); this.self = { postMessage: (data) => setTimeout(() => heard.forEach((on) => on({ data }))) }; this.addEventListener = (k, on) => k === 'message' && heard.add(on); this.removeEventListener = (_, on) => heard.delete(on); this.terminate = () => {}; new Function('self', Buffer.from(url.split(',')[1], 'base64').toString())(this.self); } postMessage(data) { setTimeout(() => this.self.onmessage({ data })); } }; + const module = await WebAssembly.compile(fs.readFileSync(new URL('../shell/kernel/guest.wasm', import.meta.url))); + const guest = { dispatch: async (request) => { + const { memory, holo_alloc, holo_run } = (await WebAssembly.instantiate(module, {})).exports, at = holo_alloc(request.length); + new Uint8Array(memory.buffer, at, request.length).set(request); + const packed = BigInt.asUintN(64, BigInt(holo_run(at, request.length))); + return new Uint8Array(memory.buffer, Number(packed >> 32n), Number(packed & 0xffffffffn)).slice(); + } }; + const { validateSpec } = await import('../shell/prism/spec.mjs'); + const fixture = JSON.parse(read('./fixtures/specs/parking-fee.json')), parking = validateSpec(fixture.spec ?? fixture); + // INV-004: always premium over eight hours unless the vehicle is a motorcycle. Read as one box it covers + // motorcycles too, which park free, and was refused; it holds, below `motorcycle` and above it. + assert.ok(parking.properties[3].when.some((c) => c.op === 'is not')); + const r = await prove(parking, { guest }); + assert.equal(r.ok, true, r.error); + assert.deepEqual([r.record.verdict, r.record.axioms ?? ['Quot.sound', 'propext']], ['proved', ['Quot.sound', 'propext']]); + // The same guarantee for every vehicle but a car does not hold (a motorcycle parks free), and is refused. + const broken = { ...parking, properties: parking.properties.map((p, i) => (i === 3 ? { ...p, when: [p.when[0], { field: 'vehicle', op: 'is not', value: 'car' }] } : p)) }; + const no = await prove(broken, { guest }); + assert.equal(no.ok, false); assert.match(no.error, new RegExp("Lean's kernel refused " + parking.properties[3].id + '$')); +}); diff --git a/v2/in-tab-kernel/REPORT.md b/v2/in-tab-kernel/REPORT.md index bab93cc0..e3d78969 100644 --- a/v2/in-tab-kernel/REPORT.md +++ b/v2/in-tab-kernel/REPORT.md @@ -56,7 +56,7 @@ the verdict's job, from the axiom report below. ## In a browser tab (Chromium 156, desktop) -`web/bench.html` in a module worker, served with no isolation headers (`crossOriginIsolated` false, no +`web/bench.html` (removed since; it is at 20fac93) in a module worker, served with no isolation headers (`crossOriginIsolated` false, no `SharedArrayBuffer`) and with the worker's network closed (`connect-src 'none'`). Summary in `evidence/browser.json`. | What | Result | diff --git a/v2/in-tab-kernel/web/bench.html b/v2/in-tab-kernel/web/bench.html deleted file mode 100644 index fd4ddd62..00000000 --- a/v2/in-tab-kernel/web/bench.html +++ /dev/null @@ -1,96 +0,0 @@ - - - -Lean kernel in the tab - -

Lean 4.32.1's kernel in this tab

-

Starting.

-

-
diff --git a/v2/in-tab-kernel/web/serve.mjs b/v2/in-tab-kernel/web/serve.mjs
deleted file mode 100644
index c6a895f4..00000000
--- a/v2/in-tab-kernel/web/serve.mjs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Development: serves v2/in-tab-kernel/ on localhost with no COOP or COEP header, so the page is not cross-origin
-// isolated, as on a static host that cannot set headers. The worker is served with connect-src 'none'.
-//   node web/serve.mjs [port]
-import { createServer } from "node:http";
-import { readFile } from "node:fs/promises";
-import { join, normalize, extname } from "node:path";
-import { fileURLToPath } from "node:url";
-
-const root = normalize(join(fileURLToPath(new URL(".", import.meta.url)), ".."));
-const types = { ".html": "text/html", ".mjs": "text/javascript", ".json": "application/json", ".wasm": "application/wasm", ".ndjson": "application/x-ndjson" };
-const port = Number(process.argv[2] ?? 8793);
-createServer(async (req, res) => {
-  const path = normalize(join(root, decodeURIComponent(new URL(req.url, "http://x").pathname)));
-  if (!path.startsWith(root)) { res.writeHead(403).end(); return; }
-  try {
-    const body = await readFile(path);
-    const headers = { "content-type": types[extname(path)] ?? "application/octet-stream", "cache-control": "no-store" };
-    if (path.endsWith("worker.mjs")) headers["content-security-policy"] = "connect-src 'none'";
-    res.writeHead(200, headers).end(body);
-  } catch { res.writeHead(404).end(); }
-}).listen(port, () => console.log(`http://localhost:${port}/web/bench.html`));
diff --git a/v2/in-tab-kernel/web/worker.mjs b/v2/in-tab-kernel/web/worker.mjs
deleted file mode 100644
index c77ef6f0..00000000
--- a/v2/in-tab-kernel/web/worker.mjs
+++ /dev/null
@@ -1,80 +0,0 @@
-// The kernel worker. It holds one instance of Lean's kernel with the pinned library resident, and judges suffixes.
-// It reaches no network (served with `Content-Security-Policy: connect-src 'none'`): the page hands it bytes, and it
-// re-derives every address itself before the kernel sees a byte (InTabKernel.kernelRunsOnlyOnAddressedBytes).
-//
-//   { op: "open", manifest, glue, wasm, library }   -> { ok, timings, heapMB } | { ok: false, refusal }
-//   { op: "check", id, suffix, sha256 }             -> { id, accepted, exit, ms, axioms, output } | { id, refusal }
-//   { op: "whole", id, bytes }                      -> the same, every declaration judged, in a fresh instance
-const now = () => performance.now();
-const hex = (buf) => [...new Uint8Array(buf)].map((b) => b.toString(16).padStart(2, "0")).join("");
-const sha256 = async (bytes) => hex(await crypto.subtle.digest("SHA-256", bytes));
-
-let factory = null, wasmBinary = null, resident = null;
-const lines = [];
-
-async function instance() {
-  // The loader would fetch the module from beside itself. It is given the bytes whose address was checked instead.
-  const m = await factory({ instantiateWasm: (imports, done) => { WebAssembly.instantiate(wasmBinary, imports).then((r) => done(r.instance, r.module)); return {}; }, locateFile: (p) => p, print: (s) => lines.push(s), printErr: (s) => lines.push(s) });
-  if (m.ccall("checker_ready", "number", [], []) !== 0) throw new Error("the kernel did not initialize: " + lines.join(" "));
-  return m;
-}
-function run(m, entry, bytes) {
-  lines.length = 0;
-  m.FS.writeFile("/in.ndjson", bytes);
-  const t0 = now();
-  let exit;
-  try { exit = m.ccall(entry, "number", ["string"], ["/in.ndjson"]); }
-  catch (e) { exit = 3; lines.push("trap: " + (e && e.message ? e.message : String(e))); }
-  const ms = now() - t0;
-  m.FS.unlink("/in.ndjson");
-  // The kernel's own report of what each accepted theorem rests on; the verdict's axiom audit reads it.
-  const axioms = {}, rest = [];
-  for (const line of lines) {
-    const m = /^axioms ([^:]+): ?(.*)$/.exec(line);
-    if (m) axioms[m[1]] = m[2] ? m[2].split(", ") : []; else rest.push(line);
-  }
-  return { accepted: exit === 0, exit, ms, axioms: exit === 0 ? axioms : {}, output: rest.join("\n").slice(-400) };
-}
-
-async function open({ manifest, glue, wasm, library }) {
-  const timings = {};
-  let t = now();
-  // Address binding: all three are checked before any of them is used.
-  const [glueSha, wasmSha, librarySha] = await Promise.all([sha256(glue), sha256(wasm), sha256(library)]);
-  timings.hashMs = now() - t;
-  if (glueSha !== manifest.glue.sha256) return { ok: false, refusal: "the kernel's loader is not the pinned one" };
-  if (wasmSha !== manifest.wasm.sha256) return { ok: false, refusal: "the kernel is not the pinned one" };
-  if (librarySha !== manifest.library.sha256) return { ok: false, refusal: "the library is not the pinned one" };
-  // The library is entered without checking, which is sound only if this kernel has judged it whole before.
-  const b = manifest.binding;
-  if (!b || b.kernel !== wasmSha || b.loader !== glueSha || b.library !== librarySha) return { ok: false, refusal: "no record that this kernel has checked this library" };
-  t = now();
-  const url = URL.createObjectURL(new Blob([glue], { type: "text/javascript" }));
-  try { factory = (await import(url)).default; } finally { URL.revokeObjectURL(url); }
-  wasmBinary = wasm;
-  const m = await instance();
-  timings.readyMs = now() - t;
-  const load = run(m, "load_library", new Uint8Array(library));
-  timings.libraryMs = load.ms;
-  if (!load.accepted) return { ok: false, refusal: "the kernel refused the pinned library: " + load.output };
-  resident = m;
-  return { ok: true, timings, heapMB: Math.round(m.HEAPU8.length / 1048576), kernel: wasmSha, library: librarySha };
-}
-
-self.onmessage = async ({ data }) => {
-  try {
-    if (data.op === "open") return self.postMessage({ op: "open", ...(await open(data)) });
-    if (data.op === "check") {
-      if (!resident) return self.postMessage({ id: data.id, refusal: "no library is resident" });
-      const bytes = new Uint8Array(data.suffix);
-      if ((await sha256(bytes)) !== data.sha256) return self.postMessage({ id: data.id, refusal: "the bundle is not the one named" });
-      return self.postMessage({ id: data.id, ...run(resident, "check_suffix", bytes), heapMB: Math.round(resident.HEAPU8.length / 1048576) });
-    }
-    if (data.op === "whole") {
-      const m = await instance();
-      return self.postMessage({ id: data.id, ...run(m, "check_whole", new Uint8Array(data.bytes)), heapMB: Math.round(m.HEAPU8.length / 1048576) });
-    }
-  } catch (e) {
-    self.postMessage({ id: data.id, op: data.op, ok: false, refusal: "the worker failed: " + (e && e.message ? e.message : String(e)) });
-  }
-};