From ed7599444ec3cee834a3b18e7afd07f5cc3fd51e Mon Sep 17 00:00:00 2001 From: humuhumu33 <68450279+humuhumu33@users.noreply.github.com> Date: Mon, 16 Nov 2026 21:29:28 +0000 Subject: [PATCH 1/4] Foundry's Prism kernel decides which device's copy of the visitor's work wins (FA-94) A sixth kind of workspace request, merge a record another device of the visitor's Prism ID sent: the newer copy is taken, a place this device does not hold is taken, and a tie goes to the sender only when it wins the tie, so two devices never both take and converge on one copy. A device-local place, an unauthentic or misplaced record, a closed workspace, and a copy over quota unless it is a deletion are refused by name. Three theorems (never older, converges, only what may enter) and thirteen merge words, each an acceptance vector the guest replays. Co-Authored-By: Claude Opus 5.5 --- CONFORMANCE.md | 1 + app/product.json | 5 +- app/src/Features.lex.tex | 9 +- app/src/ForgeKernel.lex.tex | 2 +- app/src/Workspace.lex.tex | 20 ++- app/src/WorkspaceProofs.lex.tex | 149 ++++++++++++++++++ .../tests/in_tab_kernel_verdict.rs | 28 ++++ features/suites/private-workspace.feature | 10 ++ model/ids.toml | 6 + .../application_main_integration.test.mjs | 2 +- verification/private-workspace.md | 31 ++++ 11 files changed, 255 insertions(+), 8 deletions(-) diff --git a/CONFORMANCE.md b/CONFORMANCE.md index 1c67ddda..534b6bf6 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -416,6 +416,7 @@ model does not sanction. | ID | Level | Statement | | --- | --- | --- | | `FA-91` | `build` | A private workspace opens only for the Prism id that owns it, on a device with a live session and its current boundary key; a record is read only when authentic and in place and stored only sealed; the workspace kept before an id moves in once; and Foundry's Prism kernel names every refusal | +| `FA-94` | `build` | Foundry's Prism kernel decides each record another device of the visitor's Prism ID sends: the newer copy wins, a tie goes the same way on both devices so they converge, and nothing unauthentic, misplaced, device-local or over quota enters | ## product-model diff --git a/app/product.json b/app/product.json index 7d697719..4ea94952 100644 --- a/app/product.json +++ b/app/product.json @@ -900,10 +900,11 @@ }, { "name": "Prism id", - "text": "The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay; the kernel opens a private workspace only for that id and names every refusal.", + "text": "The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay; the kernel opens a private workspace only for that id, decides which device's copy of each record wins, and names every refusal.", "ids": [ "FA-88", - "FA-91" + "FA-91", + "FA-94" ], "calls": [ "FoundrySpecification::prismIdBoundary", diff --git a/app/src/Features.lex.tex b/app/src/Features.lex.tex index 58991325..29a1c200 100644 --- a/app/src/Features.lex.tex +++ b/app/src/Features.lex.tex @@ -1375,6 +1375,13 @@ body: "crates/conformance/tests/in_tab_kernel_verdict.rs::private_workspace_fa_91" } +definition{ + name: testFA94, + parameters: [], + result: String, + body: "crates/conformance/tests/in_tab_kernel_verdict.rs::private_workspace_fa_94" +} + definition{ name: testFA61, parameters: [], @@ -1680,7 +1687,7 @@ name: featurePrismId, parameters: [], result: Foundation.Arch::Feature, - body: (record Foundation.Arch::Feature {statement := "Prism id (FA-88, FA-91): The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay; the kernel opens a private workspace only for that id and names every refusal.", calls := (cons "FoundrySpecification::prismIdBoundary" (cons "Workspace::dispatchWorkspace" (nil String))), acceptance := (cons "Features::acceptWorkspaceProofsWorkspaceWordsOwnerOpens" (cons "Features::acceptWorkspaceProofsWorkspaceWordsAnotherIdRefused" (cons "Features::acceptWorkspaceProofsWorkspaceWordsTamperedRecordRefused" (cons "Features::testFA88" (cons "Features::testFA91" (nil String))))))}) + body: (record Foundation.Arch::Feature {statement := "Prism id (FA-88, FA-91, FA-94): The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay; the kernel opens a private workspace only for that id, decides which device's copy of each record wins, and names every refusal.", calls := (cons "FoundrySpecification::prismIdBoundary" (cons "Workspace::dispatchWorkspace" (nil String))), acceptance := (cons "Features::acceptWorkspaceProofsWorkspaceWordsOwnerOpens" (cons "Features::acceptWorkspaceProofsWorkspaceWordsAnotherIdRefused" (cons "Features::acceptWorkspaceProofsWorkspaceWordsTamperedRecordRefused" (cons "Features::testFA88" (cons "Features::testFA91" (cons "Features::testFA94" (nil String)))))))}) } definition{ diff --git a/app/src/ForgeKernel.lex.tex b/app/src/ForgeKernel.lex.tex index 06733398..0fd43d0c 100644 --- a/app/src/ForgeKernel.lex.tex +++ b/app/src/ForgeKernel.lex.tex @@ -802,7 +802,7 @@ name: workspaceAcceptance, parameters: [], result: (List Foundation.View.Text.V1.Model::AcceptanceVector), - body: (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b737061636520303130303030303030303030303030303030303030303030303130303030303030313030303030303031303030303030, response := 0x6f6b}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b737061636520303130303030303030303030303030303031303030303030303130303030303030313030303030303031303030303030, response := 0x776f726b737061636544657669636552656d6f766564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b737061636520303130303030303030303030303030303030303030303030303030303030303030313030303030303031303030303030, response := 0x776f726b737061636553657373696f6e45787069726564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b737061636520303130303030303030303030303030303030303030303030303130303030303030303030303030303031303030303030, response := 0x776f726b73706163654e6f744f776e6572}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b737061636520303130303030303030303030303030303030303030303030303130303030303030313030303030303030303030303030, response := 0x776f726b73706163654b65795374616c65}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303031303030303030303130303030303030313030303030303031303030303030, response := 0x6f6b}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303031303030303030303030303030303030313030303030303031303030303030, response := 0x776f726b7370616365436c6f736564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303031303030303030303130303030303030303030303030303031303030303030, response := 0x7265636f726454616d7065726564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303031303030303030303130303030303030313030303030303030303030303030, response := 0x7265636f72644d6973706c61636564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303032303030303030303130303030303030313030303030303031303030303030, response := 0x6f6b}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303032303030303030303130303030303030303030303030303031303030303030, response := 0x7265636f7264556e7365616c6564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303032303030303030303130303030303030313030303030303030303030303030, response := 0x776f726b737061636551756f74614578636565646564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b7370616365203031303030303030303330303030303030313030303030303030303030303030, response := 0x6f6b}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b7370616365203031303030303030303330303030303030313030303030303031303030303030, response := 0x776f726b7370616365416c72656164794d6f766564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b7370616365203031303030303030303430303030303030313030303030303031303030303030, response := 0x6f6b}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b7370616365203031303030303030303430303030303030313030303030303030303030303030, response := 0x7365616c6564436f70794e6f74436f6d6d6974746564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b737061636520303230303030303030303030303030303030303030303030303130303030303030313030303030303031303030303030, response := 0x6d616c666f726d6564576f726b737061636552657175657374}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303033303030303030303130303030303030303030303030303030303030303030, response := 0x6d616c666f726d6564576f726b737061636552657175657374}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b7370616365203031303030303030303930303030303030313030303030303031303030303030, response := 0x6d616c666f726d6564576f726b737061636552657175657374}) (previewAcceptance)))))))))))))))))))) + body: (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b737061636520303130303030303030303030303030303030303030303030303130303030303030313030303030303031303030303030, response := 0x6f6b}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b737061636520303130303030303030303030303030303031303030303030303130303030303030313030303030303031303030303030, response := 0x776f726b737061636544657669636552656d6f766564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b737061636520303130303030303030303030303030303030303030303030303030303030303030313030303030303031303030303030, response := 0x776f726b737061636553657373696f6e45787069726564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b737061636520303130303030303030303030303030303030303030303030303130303030303030303030303030303031303030303030, response := 0x776f726b73706163654e6f744f776e6572}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b737061636520303130303030303030303030303030303030303030303030303130303030303030313030303030303030303030303030, response := 0x776f726b73706163654b65795374616c65}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303031303030303030303130303030303030313030303030303031303030303030, response := 0x6f6b}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303031303030303030303030303030303030313030303030303031303030303030, response := 0x776f726b7370616365436c6f736564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303031303030303030303130303030303030303030303030303031303030303030, response := 0x7265636f726454616d7065726564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303031303030303030303130303030303030313030303030303030303030303030, response := 0x7265636f72644d6973706c61636564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303032303030303030303130303030303030313030303030303031303030303030, response := 0x6f6b}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303032303030303030303130303030303030303030303030303031303030303030, response := 0x7265636f7264556e7365616c6564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303032303030303030303130303030303030313030303030303030303030303030, response := 0x776f726b737061636551756f74614578636565646564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b7370616365203031303030303030303330303030303030313030303030303030303030303030, response := 0x6f6b}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b7370616365203031303030303030303330303030303030313030303030303031303030303030, response := 0x776f726b7370616365416c72656164794d6f766564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b7370616365203031303030303030303430303030303030313030303030303031303030303030, response := 0x6f6b}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b7370616365203031303030303030303430303030303030313030303030303030303030303030, response := 0x7365616c6564436f70794e6f74436f6d6d6974746564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b737061636520303230303030303030303030303030303030303030303030303130303030303030313030303030303031303030303030, response := 0x6d616c666f726d6564576f726b737061636552657175657374}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303033303030303030303130303030303030303030303030303030303030303030, response := 0x6d616c666f726d6564576f726b737061636552657175657374}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b7370616365203031303030303030303930303030303030313030303030303031303030303030, response := 0x6d616c666f726d6564576f726b737061636552657175657374}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303035303030303030303130303030303030313030303030303031303030303030303130303030303030313030303030303031303030303030303030303030303030303030303030303032303030303030303030303030303030313030303030303030303030303030, response := 0x74616b65}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303035303030303030303130303030303030313030303030303031303030303030303130303030303030313030303030303031303030303030303030303030303030303030303030303031303030303030303030303030303030323030303030303030303030303030, response := 0x6b656570}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303035303030303030303130303030303030313030303030303031303030303030303130303030303030313030303030303031303030303030303030303030303030313030303030303030303030303030303030303030303066666666666666663030303030303030, response := 0x74616b65}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303035303030303030303130303030303030313030303030303031303030303030303130303030303030313030303030303031303030303030303030303030303030303030303030303035303030303030303030303030303030353030303030303031303030303030, response := 0x74616b65}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303035303030303030303130303030303030313030303030303031303030303030303130303030303030313030303030303031303030303030303030303030303030303030303030303035303030303030303030303030303030353030303030303030303030303030, response := 0x6b656570}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303035303030303030303130303030303030313030303030303031303030303030303130303030303030313030303030303030303030303030303030303030303030303030303030303031303030303030303030303030303030393030303030303030303030303030, response := 0x74616b65}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303035303030303030303130303030303030313030303030303030303030303030303130303030303030313030303030303031303030303030303030303030303030303030303030303032303030303030303030303030303030313030303030303030303030303030, response := 0x7265636f726454616d7065726564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303035303030303030303130303030303030313030303030303031303030303030303030303030303030313030303030303031303030303030303030303030303030303030303030303032303030303030303030303030303030313030303030303030303030303030, response := 0x7265636f72644d6973706c61636564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303035303030303030303130303030303030303030303030303031303030303030303130303030303030313030303030303031303030303030303030303030303030303030303030303032303030303030303030303030303030313030303030303030303030303030, response := 0x7265636f72644c6f63616c4f6e6c79}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303035303030303030303130303030303030313030303030303031303030303030303130303030303030303030303030303031303030303030303030303030303030303030303030303032303030303030303030303030303030313030303030303030303030303030, response := 0x776f726b737061636551756f74614578636565646564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303035303030303030303130303030303030313030303030303031303030303030303130303030303030303030303030303031303030303030303130303030303030303030303030303032303030303030303030303030303030313030303030303030303030303030, response := 0x74616b65}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b73706163652030313030303030303035303030303030303030303030303030313030303030303031303030303030303130303030303030313030303030303031303030303030303030303030303030303030303030303032303030303030303030303030303030313030303030303030303030303030, response := 0x776f726b7370616365436c6f736564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b7370616365203031303030303030303530303030303030313030303030303031303030303030303130303030303030313030303030303031303030303030303130303030303030303030303030303030303030303030303230303030303030303030303030303031303030303030, response := 0x6d616c666f726d6564576f726b737061636552657175657374}) (previewAcceptance))))))))))))))))))))))))))))))))) } definition{ diff --git a/app/src/Workspace.lex.tex b/app/src/Workspace.lex.tex index 2fa7c21e..0f78f456 100644 --- a/app/src/Workspace.lex.tex +++ b/app/src/Workspace.lex.tex @@ -40,18 +40,32 @@ body: (if (not (opened =? 1)) then 5 else (if (not (committed =? 1)) then 11 else 0)) } +definition{ + name: mergeTakes, + parameters: [present : Nat, rHi : Nat, rLo : Nat, lHi : Nat, lLo : Nat, wins : Nat], + result: Bool, + body: ((not (present =? 1)) || ((((lHi * 4294967296) + lLo) = 19 && kernel.contains("(workspaceAcceptance))))")); } + +/// `FA-94`: Foundry's Prism kernel decides each record another device of the visitor's Prism ID sends: the newer copy wins, a tie goes the same way on both devices so they converge, and nothing unauthentic, misplaced, device-local or over quota enters +#[test] +fn private_workspace_fa_94() { + // Lean proves the three merge theorems and every merge word by evaluation (`just app`), and the kernel + // gate replays each word as an acceptance vector; this holds them to each other and to dispatch. + let workspace = include_str!("../../../app/src/Workspace.lex.tex"); + let proofs = include_str!("../../../app/src/WorkspaceProofs.lex.tex"); + let kernel = include_str!("../../../app/src/ForgeKernel.lex.tex"); + assert!( + workspace.contains("name: mergeCode,") + && workspace.contains("=? 5) && ((prim length words : Nat) =? 14)") + ); + for theorem in [ + "mergeNeverTakesOlderHolds", + "mergeConvergesHolds", + "mergeTakesOnlyWhatMayEnterHolds", + ] { + assert!(proofs.contains(&format!("name: {theorem},")), "{theorem}"); + } + let words = proofs.matches("name: workspaceWords_merge").count(); + // "workspace 0100000005000000": version 1, kind 5. + let vectors = kernel + .matches("request := 0x776f726b73706163652030313030303030303035303030303030") + .count(); + assert_eq!(words, vectors); + assert!(words >= 13); +} diff --git a/features/suites/private-workspace.feature b/features/suites/private-workspace.feature index 06b97ff4..51026448 100644 --- a/features/suites/private-workspace.feature +++ b/features/suites/private-workspace.feature @@ -7,3 +7,13 @@ Feature: private-workspace Then it answers ok only for the owning id on a device with a live session and the current boundary key, for an authentic record in its place, for a sealed record within quota, for a first move, and for a removal after the sealed copy is committed And every other request is refused by name, a removed device first, and a wrong version, a trailing word or an unknown kind is malformedWorkspaceRequest And each answer is a theorem Lean proves by evaluation and an acceptance vector the compiled guest replays + + @FA-94 @build + Scenario: Foundry's Prism kernel decides each record another device of the visitor's Prism ID sends: the newer copy wins, a tie goes the same way on both devices so they converge, and nothing unauthentic, misplaced, device-local or over quota enters + Given the Workspace module in Foundry's Prism kernel, reached by the workspace request prefix with kind 5 + When it is asked whether to take a record another device sent or keep its own, with whether the place syncs, the sealed bytes are authentic and in place, the record fits, this device holds the place, the sent record is a deletion, both times and who wins a tie + Then it answers take only for a newer copy, an absent place, or a tie the sender wins, and keep otherwise + And two devices exchanging one place never both take, whatever else holds, so they converge on one copy + And it never takes an unauthentic, misplaced or device-local record, nor one over quota unless it is a deletion, and names each refusal + And each answer is a theorem Lean proves by evaluation and an acceptance vector the compiled guest replays + diff --git a/model/ids.toml b/model/ids.toml index 5867c30b..82aaf987 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -873,3 +873,9 @@ id = "FA-92" level = "build" suite = "theater" statement = "Theater, right after Library in the sidebar, plays Prism apps one after another on a stage beside an up next rail, under the build preview's own sandbox, with the floor's catalogue, covers and bookmarks, and its look is the experience spec's five Theater statements" + +[[id]] +id = "FA-94" +level = "build" +suite = "private-workspace" +statement = "Foundry's Prism kernel decides each record another device of the visitor's Prism ID sends: the newer copy wins, a tie goes the same way on both devices so they converge, and nothing unauthentic, misplaced, device-local or over quota enters" diff --git a/studio/tools/application_main_integration.test.mjs b/studio/tools/application_main_integration.test.mjs index e1ebb005..31feb081 100644 --- a/studio/tools/application_main_integration.test.mjs +++ b/studio/tools/application_main_integration.test.mjs @@ -5,7 +5,7 @@ import {test} from 'node:test'; const read=p=>fs.readFileSync(new URL('../../'+p,import.meta.url),'utf8'); test('combined canonical dispatcher retains every application protocol and experience family',()=>{ const model=read('app/src/ForgeKernel.lex.tex');for(const name of ['dispatchPreview','dispatchQueue','dispatchRouting','dispatchInteraction','dispatchEvent','dispatchWork','dispatchComposition','budgetWithin','layoutTabs','motionAllows','targetOk','recentYes','thinkAllows','IdeaReader::readIdea'])assert.ok(model.includes(name)); - assert.ok(model.includes('acceptanceVectors := (verdictAcceptance)'));assert.ok(model.includes('responseMaximum := (4096 : UInt32)'));assert.equal((model.match(/request :=/g)||[]).length,355);assert.ok(model.includes('(acceptanceExperience)')); + assert.ok(model.includes('acceptanceVectors := (verdictAcceptance)'));assert.ok(model.includes('responseMaximum := (4096 : UInt32)'));assert.equal((model.match(/request :=/g)||[]).length,368);assert.ok(model.includes('(acceptanceExperience)')); }); test('integration retains every feature registration and the main experience proof obligations',()=>{ const ids=read('model/ids.toml');const retired=new Set([4,11,16,34,45,47]);for(let n=1;n<=59;n++)assert.equal(ids.includes('id = "FA-'+String(n).padStart(2,'0')+'"'),!retired.has(n)); diff --git a/verification/private-workspace.md b/verification/private-workspace.md index d5caa42a..5c216ebe 100644 --- a/verification/private-workspace.md +++ b/verification/private-workspace.md @@ -59,3 +59,34 @@ Where it was run. `prismpm --project app verify` in the SDK image `prismpm.lock` machine: its Lean stage allows 600 seconds, and compiling the SDK's runtime from cold took longer before reaching any project module (`PP5007: application-lean timed out`). The proofs above used `prism-code` 0.8.0 with the local Lean toolchain; CI runs the gate in the SDK image. + +## Which device's copy wins (FA-94) + +Authority: `FA-94` in `model/ids.toml`, scenario in `features/suites/private-workspace.feature`. + +Why: two devices of one Prism ID each keep the visitor's work, and when they meet each must decide, for every +thing the other sends, whether to take it or keep its own, and both must end with the same copy. + +How: a sixth kind of workspace request, 5, merge a record another device sent. Its facts are whether the +workspace is open, the place syncs (it is not one of this device's own), the sealed bytes are authentic, the record +is the one its place names, it fits, this device holds the place, the sent record is a deletion, both times as +high and low 32-bit words, and whether the sender wins a tie. `Workspace::mergeCode` answers `take` for a newer +copy, a place this device does not hold, or a tie the sender wins, and `keep` otherwise; before that it refuses, +by name, a closed workspace, a device-local place (`recordLocalOnly`), an unauthentic or misplaced record, and a +copy over quota unless it is a deletion. A merge request is 14 words, 122 bytes, inside the 128-byte wire. + +Evidence: + +- Three theorems in `app/src/WorkspaceProofs.lex.tex`, each that no request meets a `breaks` condition: + `mergeNeverTakesOlderHolds` (an older copy is never taken), `mergeConvergesHolds` (two devices exchanging one + place, the tie going one way on each, never both take, whatever else holds), and + `mergeTakesOnlyWhatMayEnterHolds` (nothing closed, device-local, unauthentic, misplaced or over quota enters). +- Thirteen `workspaceWords_merge` theorems Lean proves by evaluation, each also an acceptance vector the guest + replays: newer taken, older kept, the high word deciding, a tie won and lost, an absent place, each refusal, a + deletion over quota taken, and a short request refused. +- `private_workspace_fa_94` (`crates/conformance/tests/in_tab_kernel_verdict.rs`) holds the dispatch arm, the + three theorems, and the merge words to the merge vectors one for one; `private_workspace_fa_91` still holds + every workspace word to every workspace vector (32). `application_main_integration.test.mjs` counts 368. + +Before the model, `private_workspace_fa_94` failed (`3 passed; 1 failed`); after it, 4 passed. + From 94a2cc9aa5ab0bc7bf95c024eb0400a29227f732 Mon Sep 17 00:00:00 2001 From: humuhumu33 <68450279+humuhumu33@users.noreply.github.com> Date: Mon, 16 Nov 2026 21:39:44 +0000 Subject: [PATCH 2/4] Workspace merge: multiply as LexLean spells it (prim multiply) Co-Authored-By: Claude Opus 5.5 --- app/src/Workspace.lex.tex | 2 +- app/src/WorkspaceProofs.lex.tex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/Workspace.lex.tex b/app/src/Workspace.lex.tex index 0f78f456..b8068c75 100644 --- a/app/src/Workspace.lex.tex +++ b/app/src/Workspace.lex.tex @@ -44,7 +44,7 @@ name: mergeTakes, parameters: [present : Nat, rHi : Nat, rLo : Nat, lHi : Nat, lLo : Nat, wins : Nat], result: Bool, - body: ((not (present =? 1)) || ((((lHi * 4294967296) + lLo) Date: Mon, 16 Nov 2026 21:50:14 +0000 Subject: [PATCH 3/4] Merge proof: one comparison group LexLean parses; conformance tests find the repository root in one line The doubled parentheses around the older-copy comparison did not parse (LLP2001 at WorkspaceProofs.lex.tex:283). Eight conformance tests now take the repository root as CARGO_MANIFEST_DIR/../.., so the counted lines shrink. Co-Authored-By: Claude Opus 5.5 --- app/src/WorkspaceProofs.lex.tex | 2 +- crates/conformance/tests/app_covers.rs | 6 +----- crates/conformance/tests/application_main_integration.rs | 6 +----- crates/conformance/tests/application_shape_authority.rs | 6 +----- crates/conformance/tests/atomic_browser_settings.rs | 6 +----- crates/conformance/tests/atomic_chat_preferences.rs | 6 +----- crates/conformance/tests/atomic_project_lifecycle.rs | 6 +----- crates/conformance/tests/authoring_projection.rs | 6 +----- crates/conformance/tests/in_tab_kernel_verdict.rs | 6 +----- 9 files changed, 9 insertions(+), 41 deletions(-) diff --git a/app/src/WorkspaceProofs.lex.tex b/app/src/WorkspaceProofs.lex.tex index 3a5eed25..4a2fcda2 100644 --- a/app/src/WorkspaceProofs.lex.tex +++ b/app/src/WorkspaceProofs.lex.tex @@ -280,7 +280,7 @@ name: breaksMergeNeverTakesOlder, parameters: [opened : Nat, syncs : Nat, authentic : Nat, bound : Nat, within : Nat, gone : Nat, rHi : Nat, rLo : Nat, lHi : Nat, lLo : Nat, wins : Nat], result: Bool, - body: (((((prim multiply rHi 4294967296 : Nat) + rLo) Date: Mon, 16 Nov 2026 22:04:42 +0000 Subject: [PATCH 4/4] Workspace merge: lexlean fmt Co-Authored-By: Claude Opus 5.5 --- app/src/Workspace.lex.tex | 15 ++++- app/src/WorkspaceProofs.lex.tex | 112 +++++++++++++++++++++++++++++--- 2 files changed, 117 insertions(+), 10 deletions(-) diff --git a/app/src/Workspace.lex.tex b/app/src/Workspace.lex.tex index b8068c75..1c25a252 100644 --- a/app/src/Workspace.lex.tex +++ b/app/src/Workspace.lex.tex @@ -49,7 +49,20 @@ definition{ name: mergeCode, - parameters: [opened : Nat, syncs : Nat, authentic : Nat, bound : Nat, within : Nat, present : Nat, gone : Nat, rHi : Nat, rLo : Nat, lHi : Nat, lLo : Nat, wins : Nat], + parameters: [ + opened : Nat, + syncs : Nat, + authentic : Nat, + bound : Nat, + within : Nat, + present : Nat, + gone : Nat, + rHi : Nat, + rLo : Nat, + lHi : Nat, + lLo : Nat, + wins : Nat + ], result: Nat, body: (if (not (opened =? 1)) then 5 else (if (not (syncs =? 1)) then 12 else (if (not (authentic =? 1)) then 6 else (if (not (bound =? 1)) then 7 else (if (mergeTakes present rHi rLo lHi lLo wins) then (if ((gone =? 1) || (within =? 1)) then 13 else 9) else 14))))) } diff --git a/app/src/WorkspaceProofs.lex.tex b/app/src/WorkspaceProofs.lex.tex index 4a2fcda2..113fce03 100644 --- a/app/src/WorkspaceProofs.lex.tex +++ b/app/src/WorkspaceProofs.lex.tex @@ -278,46 +278,140 @@ definition{ name: breaksMergeNeverTakesOlder, - parameters: [opened : Nat, syncs : Nat, authentic : Nat, bound : Nat, within : Nat, gone : Nat, rHi : Nat, rLo : Nat, lHi : Nat, lLo : Nat, wins : Nat], + parameters: [ + opened : Nat, + syncs : Nat, + authentic : Nat, + bound : Nat, + within : Nat, + gone : Nat, + rHi : Nat, + rLo : Nat, + lHi : Nat, + lLo : Nat, + wins : Nat + ], result: Bool, body: ((((prim multiply rHi 4294967296 : Nat) + rLo)