Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions CONFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,6 @@ model does not sanction.
| --- | --- | --- |
| `PM-01` | `build` | Foundry is one Prism model whose architecture, design, features, security, quality and compliance facets are projected from app/product.json and the kernel, and whose quality thresholds are the kernel's own terms |

## proof-reuse

| ID | Level | Statement |
| --- | --- | --- |
| `FA-85` | `build` | A theorem Lean proved on the same declarations is reused instead of proved again, and only changed theorems go to Lean |

## proposal-admission

| ID | Level | Statement |
Expand Down
10 changes: 4 additions & 6 deletions app/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,17 +826,15 @@
},
{
"name": "Proof",
"text": "A verdict is decided by the guest from what the tab derived, a theorem proved on the same declarations is reused, and local obligations hold on every request.",
"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-85",
"FA-86",
"LL-01",
"LL-02"
],
"calls": [
"InTabKernel::verdictCode",
"InTabKernelProtocol::dispatchVerdict",
"FoundrySpecification::proofReuseBoundary"
"InTabKernelProtocol::dispatchVerdict"
],
"registry": [],
"components": [
Expand Down Expand Up @@ -1245,11 +1243,11 @@
"text": "A proof is reused for declarations or a toolchain other than the ones Lean checked.",
"control": {
"name": "Proof reuse by exact inputs",
"text": "A proof is reused only under an address covering the theorem, every declaration it reaches and the exact toolchain.",
"text": "A proof stands only for the exact module bytes the kernel in the tab judged, against the pinned kernel and library; a changed module drops it.",
"evidence": [
{
"kind": "gate",
"reference": "FA-85 proof-reuse, cargo test in just vv"
"reference": "FA-86 in-tab-kernel-verdict, cargo test in just vv"
}
]
},
Expand Down
9 changes: 1 addition & 8 deletions app/src/Features.lex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1219,13 +1219,6 @@
body: "crates/conformance/tests/stateful_application_journeys.rs::stateful_application_journeys_fa_42"
}

definition{
name: testFA85,
parameters: [],
result: String,
body: "crates/conformance/tests/proof_reuse.rs::proof_reuse_fa_85"
}

definition{
name: testFA86,
parameters: [],
Expand Down Expand Up @@ -1636,7 +1629,7 @@
name: featureProof,
parameters: [],
result: Foundation.Arch::Feature,
body: (record Foundation.Arch::Feature {statement := "Proof (FA-85, FA-86, LL-01, LL-02): A verdict is decided by the guest from what the tab derived, a theorem proved on the same declarations is reused, and local obligations hold on every request.", calls := (cons "InTabKernel::verdictCode" (cons "InTabKernelProtocol::dispatchVerdict" (cons "FoundrySpecification::proofReuseBoundary" (nil String)))), acceptance := (cons "Features::testFA85" (cons "Features::testFA86" (cons "Features::testLL01" (cons "Features::testLL02" (nil String)))))})
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))))})
}

definition{
Expand Down
24 changes: 0 additions & 24 deletions app/src/FoundrySpecification.lex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1313,29 +1313,5 @@
result: String,
body: "Stateful app parsing and checking require explicit browser approval before source leaves for https://mcp.uor.foundation/. A standalone operation discloses its immutable exact files. A streaming generation session discloses its application, unique turn, captured source identity, current exact files, and permission for subsequent generated module prefixes, repairs and supporting LexLean library modules in that same turn. This preserves incremental previews without treating inference or network-free frame permission as hosted-source consent. It does not permit another turn, application, destination, proof, publication or arbitrary network operation. Approval remains only in document memory, is unavailable offline, and expires within five minutes including active work. The host asserts current source and turn ownership before each request and after completion; only its own successful compare-and-swap commit may advance its expected local source. Denial, Escape, stop, generation cancellation and expiry are typed private refusals. A session remembers refusal without repeatedly prompting. A modal focuses denial and renders source as text; its active stop control explains that abort cannot recall transmitted data or stop remote work. Each parse/check operation further binds its exact file set and permits only one draft write plus matching draft checks or data reads. Requests omit cookies and credentials, reject redirects, use a bounded cancellation-aware deadline, and validate private fixed response failures. Malformed or refused service responses do not become checks or proofs. Replaced, forgotten or cancelled preview work cannot publish late frames. Preview attempts are identified by requested source and permission scope together: a refused attempt suppresses repeat prompts only in that scope, while a fresh scope may retry identical source. Reselecting a previously rendered module cancels and supersedes pending different-source work before reusing its frame, so stale content cannot acquire the selected module's trust. Incomplete replacement source also supersedes pending work without relabeling the last rendered frame. This is a hosted parsing/checking permission boundary, not proof verification, retention enforcement, same-origin caller authentication or overall release acceptance."
}

inductive{
name: ProofReuseRefusal,
type_parameters: [],
parameters: [],
constructors: [
{name: proofReuseAbsent, fields: []},
{name: proofReuseMalformed, fields: []},
{name: proofReuseAddressMismatch, fields: []},
{name: proofReuseVerifierMismatch, fields: []},
{name: proofReuseBytesMismatch, fields: []},
{name: proofReuseAttestationNotFound, fields: []},
{name: proofReuseNeededByChange, fields: []},
{name: proofReuseTrustUnavailable, fields: []},
{name: proofReuseTrustMismatch, fields: []}
]
}

definition{
name: proofReuseBoundary,
parameters: [],
result: String,
body: "A hosted proof covers theorems, and each theorem has an address: the SHA256 of length-framed fields naming the verifier (server, profile and the profile identity it reports), the local trust policy epoch, the current service trust epoch and the SHA256 addresses of Lean, Lake, leanchecker, LexLean and compiler semantics, every library file sent, each author module's header, the theorem's own declaration and every author declaration it reaches by name, transitively. A declaration of a kind other than structure, inductive, definition or theorem is reached by every theorem. Declarations are compared without their axioms member and with layout whitespace outside strings made canonical; whitespace between tokens and inside strings is kept. After a verified run, each theorem proved is filed under its address with the exact author files sent, their SHA256 digests, the axiom sets Lean observed for it and the declarations it reaches, and the attestation. A filed record stands for a theorem only when it is well formed, names that theorem, its address and verifier equal the current ones, every file hashes to its digest, the files have the current modules' paths and headers, they hold the theorem and every declaration it reaches, and the verifier still reports that exact attestation as verified under the same trust descriptor, covering every recorded file digest. A bare found result is insufficient. Otherwise the refusal is typed and the theorem is proved again; a theorem still to be proved that names a reused one returns it to the run. Reused theorems are removed from the files Lean is sent, their observed axiom sets are applied first, and when every theorem is reused Lean does not run and the result names the attestations it rests on. The reuse schema is prism/proof-reuse/2 and the local policy epoch is foundry/proof-reuse-trust/1. A fresh profile lookup must carry lexlean-mcp/proof-reuse-trust/1 with an epoch and all five toolchain addresses as lowercase SHA256 hex; the two Lean 4.32.1 executable addresses pinned by the current SDK are retired for reuse. Missing, legacy, malformed or retired trust evidence refuses reuse with proofReuseTrustUnavailable; a mismatch refuses reuse with proofReuseTrustMismatch. Every lookup is by the recorded attestation ID. The descriptor is read again before committing a reused result; a change reruns the entire proof without reuse. A newly proved record is filed only when that exact attestation and a fresh descriptor agree, never by stamping an earlier proof with a later toolchain. Unsupported service metadata falls back to full proving, without filing reusable records. This does not block fresh proofs or change their existing acceptance boundary. Records live in the browser's own store; failing reads count as absent and failing writes are dropped. Lookups send only attestation IDs and the profile name, never source. This saves proof time; it is not an independent kernel check, does not prove that the verifier's attestation lookup is sound, does not repair a verifier or establish its soundness, and does not change publication, which proves the whole app again in the SDK image."
}
\end{semanticmodule}
\end{lexlean}
2 changes: 1 addition & 1 deletion app/src/Security.lex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@
name: modeledControlProofReuseByExactInputs,
parameters: [],
result: Production.ThreatModel::ModeledControl,
body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofReuseByExactInputs", name := "Proof reuse by exact inputs", text := "A proof is reused only under an address covering the theorem, every declaration it reaches and the exact toolchain.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.gate), reference := "FA-85 proof-reuse, cargo test in just vv"}) (nil Production.ThreatModel::Evidence))})
body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofReuseByExactInputs", name := "Proof reuse by exact inputs", text := "A proof stands only for the exact module bytes the kernel in the tab judged, against the pinned kernel and library; a changed module drops it.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.gate), reference := "FA-86 in-tab-kernel-verdict, cargo test in just vv"}) (nil Production.ThreatModel::Evidence))})
}

definition{
Expand Down
37 changes: 0 additions & 37 deletions crates/conformance/tests/proof_reuse.rs

This file was deleted.

15 changes: 0 additions & 15 deletions features/suites/proof-reuse.feature

This file was deleted.

6 changes: 0 additions & 6 deletions model/ids.toml
Original file line number Diff line number Diff line change
Expand Up @@ -832,12 +832,6 @@ level = "build"
suite = "application-shape-authority"
statement = "Application shape edits and transitions retain one source-bound authority and cannot obtain proof standing from authored files"

[[id]]
id = "FA-85"
level = "build"
suite = "proof-reuse"
statement = "A theorem Lean proved on the same declarations is reused instead of proved again, and only changed theorems go to Lean"

[[id]]
id = "FA-86"
level = "build"
Expand Down
53 changes: 53 additions & 0 deletions studio/proof/PrismLive/Regions.lean
Original file line number Diff line number Diff line change
Expand Up @@ -740,3 +740,56 @@ theorem ruleJudge_sound (P : List Nat) (p : Property) (hc : wordsCheck P p = tru
exact regionCheck_sound _ _ _ _ hreg p (by simp) x hbox

end PrismLive.Kernel

/-!
# A stateful app's promises, for every app the app notation writes

The notation (shell/live/notation.mjs) states five kinds of promise. Each one's proof has the same shape for
every app, so it is proved here once. The tab writes an app's own definitions and theorems as kernel terms and
proves each theorem by applying one lemma below to that app's terms; Lean's kernel, in the tab, judges it.
-/

namespace PrismLive.Tables

theorem blt_self (n : Nat) : Nat.blt n n = false := by
cases h : Nat.blt n n
· rfl
· exact absurd (Nat.le_of_ble_eq_true h) (Nat.lt_irrefl n)

/-- A press that a guard refuses leaves the state as it was, so its revision does not move. -/
theorem refused {α : Type} (rev : α → Nat) (s t : α) (bad g : Bool) (h : bad = true → g = false) :
(bad && Nat.blt (rev s) (rev (if g = true then t else s))) = false := by
cases bad
· rfl
· simp [h rfl, blt_self]

/-- A guard that fails fails the conjunction it starts. -/
theorem left {a b c : Bool} (h : a = true → b = false) (ha : a = true) : (b && c) = false := by
simp [h ha]

/-- A guard that fails fails the conjunction it ends. -/
theorem right {a b c : Bool} (h : a = true → c = false) (ha : a = true) : (b && c) = false := by
simp [h ha]

/-- A value outside `1..m` (an empty or too long text, an unmade choice) fails its guard. -/
theorem outside (n m : Nat) (h : (Nat.beq n 0 || Nat.ble (m + 1) n) = true) :
(Nat.ble 1 n && Nat.ble n m) = false := by
simp only [Bool.or_eq_true, Nat.beq_eq, Nat.ble_eq] at h
cases h1 : Nat.ble 1 n <;> cases h2 : Nat.ble n m <;> simp_all [Nat.ble_eq] <;> omega

/-- A full table fails the guard that it has room. -/
theorem full (n m : Nat) (h : Nat.ble m n = true) : Nat.blt n m = false := by
simp only [Nat.ble_eq] at h
cases h1 : Nat.blt n m <;> simp_all [Nat.blt_eq] <;> omega

/-- A press from an out-of-date screen leaves the state as it was, so its revision does not move. -/
theorem stale {α : Type} (rev : α → Nat) (s x : α) (seen : Nat) :
((Nat.blt seen (rev s) || Nat.blt (rev s) seen) &&
(Nat.blt (rev (if Nat.beq seen (rev s) = true then x else s)) (rev s) ||
Nat.blt (rev s) (rev (if Nat.beq seen (rev s) = true then x else s)))) = false := by
cases h : Nat.beq seen (rev s)
· simp [blt_self]
· have : seen = rev s := Nat.eq_of_beq_eq_true h
subst this; simp [Nat.blt_eq]

end PrismLive.Tables
Loading
Loading