sir: flat memory with guarded stores - #23
Closed
Eduardogbg wants to merge 1 commit into
Closed
Conversation
Flat memory adds an in-bounds obligation on mstore32 to the progress theorems, alongside the control-point disjunction and the allocation obligations that already carry names. Written out at every use it makes the statements unreadable, so it becomes Program.StoreInBounds in Spec/Step.lean, next to the step relation whose precondition it is. It unfolds definitionally, so no proof changed.
Eduardogbg
force-pushed
the
sir/memory-model
branch
from
August 7, 2026 05:35
83cec87 to
40b23f4
Compare
Collaborator
Author
|
superseded by #26 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Memory becomes a flat byte store with allocations as write authority:
mload32reads it directly andmstore32fires only inside a provisioned region.What changed
Allocationdrops itsbytespayload for{ offset, size }, andMemoryStatecarriesstore : Nat → UInt8besideprovisioned.MemoryState.emptyzero-fills; an arbitraryMemoryStateanswers anything outside its allocations.mload32loses itsVector UInt8 32oracle and reads 32 bytes from the store, soStmt.isMemOracleshrinks tomallocUninitandDecoder.NoMloaddisappears from the dialogue. Memory-reading programs come inside theMemOracleFreedeterminism family;bareLoad_deterministicwitnesses one that was outside it before.mstore32throws.storeOutOfBoundsunless a single provisioned allocation contains the whole 32-byte range. This narrows the step relation. A 32-byte store straddling two abutting allocations used to execute and write both halves; it is now rejected, and a program whose first store is out of bounds is deterministic by being stuck.Program.StoreInBounds, a premise about the statement at the current control point. Every other export is byte-identical while quantifying over the smaller relation.