Skip to content

sir: flat memory with guarded stores - #23

Closed
Eduardogbg wants to merge 1 commit into
sir/generic-machinefrom
sir/memory-model
Closed

sir: flat memory with guarded stores#23
Eduardogbg wants to merge 1 commit into
sir/generic-machinefrom
sir/memory-model

Conversation

@Eduardogbg

Copy link
Copy Markdown
Collaborator

Memory becomes a flat byte store with allocations as write authority: mload32 reads it directly and mstore32 fires only inside a provisioned region.

What changed

  • Allocation drops its bytes payload for { offset, size }, and MemoryState carries store : Nat → UInt8 beside provisioned. MemoryState.empty zero-fills; an arbitrary MemoryState answers anything outside its allocations.
  • mload32 loses its Vector UInt8 32 oracle and reads 32 bytes from the store, so Stmt.isMemOracle shrinks to mallocUninit and Decoder.NoMload disappears from the dialogue. Memory-reading programs come inside the MemOracleFree determinism family; bareLoad_deterministic witnesses one that was outside it before.
  • mstore32 throws .storeOutOfBounds unless 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.
  • Both progress theorems gain Program.StoreInBounds, a premise about the statement at the current control point. Every other export is byte-identical while quantifying over the smaller relation.

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

Copy link
Copy Markdown
Collaborator Author

superseded by #26

@Eduardogbg Eduardogbg closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant