Repository navigation
In-tab kernel: prove an app with no server, work kept by address, Firefox and WebKit - #196
humuhumu33 wants to merge 19 commits into
Conversation
web/engines.mjs runs web/bench.html through Playwright with no isolation headers. Firefox 153 and WebKit 26.5 each give Lean's verdict on all 14 inputs and refuse all four address faults. WebKit matches Chromium; Firefox is about three times slower at every step, with its slowest project near the 500 ms budget. WebKit here is Safari's engine built for Windows, and the phone row is a viewport and user agent only. No phone has run this. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… library Reading the 25.7 MB library is about 80% of opening the kernel (read ~800 ms, enter ~200 ms natively). snapshot-probe.mjs takes the kernel's memory once the library is resident and restores it into a fresh instance: 35 ms under Node, and the restored kernel gives the same verdict as one that read the library on all 14 inputs. The image is 80.5 MB, about 10 MB compressed, against 4.07 MB for the library. Two builds of it differ in about 140 bytes, not yet explained. A probe only: no dist, binding or worker uses the image. The loader now exports its memory, and loadLibrary reports its two times, so the kernel's address changes; evidence/library-binding.json is for the earlier build. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The worker keeps a verdict under the addresses of the kernel, the library and the suffix, and the kernel's memory with the library resident under the kernel's and the library's. A read is believed only if it names the addresses asked for and, for the image, re-derives to its own; anything else is a miss, and a miss does the work in full. In Chromium a later open takes 0.30 s from the image against 1.54 s by reading the library, and a project met before answers in 0.5 to 1.2 ms. Firefox: 0.37 s against 11.6 s. Each engine agrees with native Lean on all 14 inputs each of four ways, and refuses every fault planted, among them an altered image and a kept verdict under another name. Opened from the image the kernel holds 117 MB against 77. The store is the origin's own and is not evidence to anyone else. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… proof search closed-forms.py retries each theorem LexLean renders as simp, split and omega with rfl, with rfl after splitting records, and with decide. On the two sample projects: of 5 such theorems, 2 pass with rfl and 3 need search; 2 more are rfl as written. A measurement of what a prover with no elaborator would have to cover, not a proof used anywhere. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ator studio/proof/PrismLive already proves regionCheck sound for every app. So an app's proof is two fixed terms: Eq.refl true for the checker evaluated on the app's rules, and regionCheck_sound applied to it. live/emit.mjs writes them, with the rules as kernel data, as a suffix of a library that holds the checker and its proof; Lean's kernel judges it. Under Node: the library is 6.57 MB (1.05 MB gzip); a proof is written in 1 to 5 ms; parking-fee is accepted in 18 ms; a guarantee the rules break, and rules edited to break a guarantee, are refused; Verdant, 35 rules and 15 guarantees, is accepted in 2.6 s at 191 MB. A probe: no browser has run it, nothing in the studio uses it, and the data written is not tied to what the app's rule module runs. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
proofsOf writes a suffix per guarantee, each whole in itself; regionCheck_sound holds for a list of one. Verdant's 15 are each accepted, in 0.15 to 1.2 s at 111 MB, in a run where the whole proof took 5.6 s at 191 MB. The total work is the same; a guarantee's verdict then depends only on the rules, the bounds and itself. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
On Verdant the proof makes 312 obligations and 5,485 box subtractions. 278 obligations have an empty region; the other 34 are distinct and need 98 subtractions of boxes that touch their region. The kernel judges those in 0.65 to 0.85 s against 1.6 to 2.2 s for the checker as it is. Three reshapings of the checker did not help; a one-pass version was far worse. Measurements only: no soundness theorem takes the touching boxes as given yet. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
live/Certified.lean proves certCheck_sound: for one guarantee, the proof names which earlier rules to subtract at each rule and may point at a fact already proved. Neither is trusted; a wrong name can only make the check fail, and every fact is a hypothesis to be discharged. It rests on propext and Quot.sound, as regionCheck_sound does, and is built beside studio/proof, which is unchanged. Verdant, one guarantee at a time in the WebAssembly kernel: 2.5 s in all at 77 MB, against 5.1 s at 111 MB through regionCheck_sound. A guarantee the rules break and a proof missing a rule it needs are both refused. The facts are not used yet: taking an obligation from an earlier proof needs the kernel's environment to keep that proof. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
check_keep leaves an accepted suffix resident, so later proofs can name its theorems. Keeping only the subtractions (reuse.mjs) did not help: the kernel spends its time on the checker's small evaluations, redone per guarantee. Linked.lean's linked_sound makes every evaluation a fact about plain data, kept and named by address, and assembles a guarantee by lemma application alone. On Verdant an edit to one rule re-judges 9 to 18 of 422 facts and costs about 0.3 s instead of 2 s. Planted faults are all refused. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The worker's new prove op takes an app as data, writes each statement and its proof, and has the kernel judge them, keeping facts by address. The proving loop is one module (live/prove.mjs) shared with the Node test. web/live.html in Edge, Firefox and WebKit: all 15 of Verdant's guarantees accepted, first proof 1.1 to 3.6 s, one edited rule 0.16 to 0.76 s, the broken guarantee refused. Download 1.57 MB gzip. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
With ?proof=tab, approving a rules app proves its guarantees in the tab: Lean 4.32.1's kernel judges proofs written there from the spec, and the Forge kernel guest decides the verdict from what the tab derived. Only its word proved marks the app proved. A spec the tab cannot read as boxes, or any other answer, goes to the hosted verifier as before, and publish asks it for an attestation before it builds. The kernel, the checker library and the proof writer ship in studio/shell/in-tab, each named by SHA-256 in its manifest. Six Node tests run the real kernel and guest; a browser check runs the worker in Edge, Firefox and WebKit; fifteen planted defects are refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tab.lean's tab_sound reads a region as zones: a box and difference constraints. is not splits a zone, a comparison of two fields adds a constraint, and a zone is empty when its constraints close to a field above itself. zonesOf is proved exact; emptiness is proved sound. Guarantees are assembled from kept facts as before, on propext and Quot.sound. A number with no maximum is bounded by the largest a request can carry. The shipped fixtures that went to the hosted verifier (RSVP's party > seats, the parking fee's is not) now prove in the tab, and the data proved answers all 168 sampled requests as the rules do. Verdant proves in 1.3 s first and 0.3 to 0.6 s after an edit. Eight planted defects are refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Approval asks one prover, the tab, and the rules are proved only on the Prism guest's word proved; any other answer leaves them checked with its reason. The switch and the hosted fallback are gone. A proof is committed only when its answer is in, so an approval cancelled while the tab proves is rolled back. Publish hands the build the attestation the rules carry, none for a proof made in the tab, and the renderer's axiom sets; the published repository proves its model again in its own CI with the locked SDK, as before. The four published apps read record exactly those sets. Rules over the SDK's limit of 24 are proved and not published. FA-87 now claims only the proof in the tab. Seven planted defects are refused; the suites that stubbed the hosted prover for rules stub the tab. Stateful apps still use the hosted verifier. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Approving in the studio from this branch showed the tab's proof message claiming facts judged before when every fact was new. The suite now checks both forms. The studio run (approve twice, publish without GitHub, RSVP's comparison of fields; no request outside the page) is recorded with how the local site was made. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
proveRules now asks inTab.proveInTab (FA-89). This check rebuilds the host's rules functions with a fixed scope, which had only the hosted prover, so the lane stopped at it. The stand-in answers and then commits, as the client does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main registered FA-87 for the Prism R4 route meanwhile, so the in-tab capabilities are FA-88 (a rules app proved in the tab), FA-89 (every rule a spec can state) and FA-90 (no hosted verifier for rules apps). Main's front-end trace (PM-02) asks every register ID to belong to a back-end feature: the three join Proof, beside FA-86, and the facets are projected again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main registered FA-88 for the Prism id meanwhile, so the in-tab capabilities are FA-89 (a rules app proved in the tab), FA-90 (every rule a spec can state) and FA-91 (no hosted verifier for rules apps), under the Proof feature. The facets are projected again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Prove rule apps in the tab with Lean's kernel, no server A rule app's guarantees are now proved in the browser tab. Lean's kernel, compiled to WebAssembly (the kernel from #196), runs in a worker with a library exported from studio/proof resident, and judges one suffix per guarantee. The Forge kernel guest gives the verdict (InTabKernel). Nothing is sent to mcp.uor.foundation for a rule app any more. The theorem is about what the published app runs. Regions.lean now holds RuleJudge's definitions exactly as LexLean writes them in Lean, and proves ruleJudge_sound: if wordsCheck holds on an app's words, ruleOutcome answers no in-bounds request that breaks the guarantee. `is not` conditions in rules are split into below/above boxes, with the first match unchanged. Axioms: propext, Quot.sound. CI checks, each keyed by its inputs: - every copied RuleJudge definition equals `lexlean build` output (SDK) - the shipped library is studio/proof's export, byte for byte - the pinned kernel judges the library whole (the binding) To pay the Prism-only ratchet, the hosted rule-proof wrapper goes, and so do the v2/in-tab-check scripts (their report stays). Non-Prism lines shrink by 683. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3MM6ryyrahRTAs9z3M * conformance: live-lexlean requires the axioms of all three theorems Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3MM6ryyrahRTAs9z3M * conformance: proof-reuse oracle counts the 12 tests left after rule apps moved in-tab Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3MM6ryyrahRTAs9z3M * studio: the generation patch fixture hands proveRules the kernel it now proves on Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3MM6ryyrahRTAs9z3M * studio: the large-module check asserts the 24-rule proving cap is gone Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3MM6ryyrahRTAs9z3M --------- Co-authored-by: Claude <noreply@anthropic.com>
|
@afflom, a proposal for landing in-browser proving under What this PR does today. Approving a rules app proves its guarantees in the tab. Lean 4.32.1's own kernel, compiled to WebAssembly, judges proofs written there from the spec, and the Forge kernel guest gives the verdict (FA-86). No request leaves the page, and publishing needs no hosted attestation. In the studio a rules app proves in 0.3 to 1.1 s, against 2 to 4 minutes on the hosted verifier. Every check passes except What I propose, so the result is Prism wherever it can be.
What I'm asking. Would you accept item 2, and the shape overall? It is the one change to the audit itself; everything else stays within the ratchet. If you'd rather not admit a lock for the verifier, I'd like to know what form you would accept for the WebAssembly loader, since the tab can't run Lean's kernel without one. |
|
Closing this as superseded. #227 shipped in-tab proving on main with this PR's Lean kernel build, byte for byte ( Two cases this PR proved still fail on the live site:
|
What this adds
Follow-up to #174. Everything is a prototype under
v2/in-tab-kernel/; no published build reads it and the studio still calls the hosted verifier. Start withv2/in-tab-kernel/REPORT.md.live/).studio/proof/PrismLivealready provesregionChecksound for every app. So an app's proof is two fixed terms:Eq.refl truefor the checker evaluated on the app's rules, andregionCheck_soundapplied to it.live/emit.mjswrites them, with the rules as kernel data; Lean's kernel judges the result.web/worker.mjs). A verdict is kept under the addresses of the kernel, the library and the suffix; the kernel's memory with the library resident is kept under the kernel's and the library's. A read is believed only if it names the addresses asked for and, for the image, re-derives to its own. Anything else is a miss, and a miss does the work in full.web/engines.mjs), through Playwright.snapshot-probe.mjs), and which arithmetic theorems Lean accepts without proof search (prover/closed-forms.py).Evidence
Proving an app in the kernel, WebAssembly under Node on one loaded desktop (
evidence/live.json):regionCheck_soundand all it rests onThe proofs Lean wrote for the same two apps are judged in the same time and rest on the same axioms,
propextandQuot.sound.Kept by address, 7 runs (
evidence/browser.json,evidence/engines.json). The engines ran while other builds loaded the machine; compare within a column.The faults include an image with one byte changed and a kept verdict rewritten to another suffix's; both end in the work being done in full.
What a reviewer should know
live/has run under Node only. No browser has run it, and nothing in the studio uses it.PrismLive.Kernel.judgeon the dataemit.mjswrites. That the data is what the app's rule module decides with is not proved.regionCheckrefuses a rule that compares two fields.loadLibraryreports its two times), andevidence/library-binding.jsonis rebound to it.just vvwas not run locally; nothing outsidev2/changes.🤖 Generated with Claude Code