sir: parametric machine and the Vars and Stack languages - #26
Closed
Eduardogbg wants to merge 17 commits into
Closed
sir: parametric machine and the Vars and Stack languages#26Eduardogbg wants to merge 17 commits into
Eduardogbg wants to merge 17 commits into
Conversation
This was referenced Aug 12, 2026
Eduardogbg
force-pushed
the
sir/machine-languages
branch
2 times, most recently
from
August 13, 2026 07:25
1275cc5 to
014009d
Compare
Eduardogbg
force-pushed
the
sir/machine-languages
branch
from
August 13, 2026 08:37
014009d to
e759e2f
Compare
Eduardogbg
marked this pull request as ready for review
August 18, 2026 20:28
Collaborator
Author
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.
this PR splits SIR into two languages: Vars (a CFG over named locals with block arguments) and Stack (variables materialized on the stack and in memory slots; the last layer before bytecode). supersedes #20, #22, #23, #24.
Machine, parametric over anOperandFrame(how an instruction fetches operands and stores results: locals vs the stack), aDecoder(how the program is read: next instruction, terminators, internal-call return, function entry) and aMemoryPolicy(which regions an allocation may take). the two languages differ precisely in theirOperandFrameandDecoder; the memory model is shared.Decodercarries proofs that an instruction and a terminator never sit at the same control point (exclusive) and that nothing decodes afterreturned/halted(terminal).bumpAllocand prove the policy allows it (memoryPolicy_allows_bumpAlloc), so a bump allocator is one legal implementation. also adds a zeroedmallocbesidemallocUninit.mstore32fails out-of-bounds;mload32stays an oracle read.Machinelevel, underNoMload(in-bounds mloads are deterministic, so this can be weakened) and [deterministic policy ORNoMalloc];VarsandStackexport them 1:1 underMemOracleFree.Function := { entry : Block, rest : Array Block }always has an entry block, andProgram := { init : Function, main : Option Function, rest : Array Function }always has an init function and optionally a separate main function.Sir/{Spec,Proofs,Theorems}/*.leansplit, a vertical one:Sir/{Machine,Vars,Stack}/{Spec,Proofs,Theorems}.lean, withSpec/andProofs/subdirectories where a module needs them.