Repository navigation
Prove RISC-V instructions match Clean model: shifts, comparisons and branch conditions. - #1033
Open
nicole-graus wants to merge 12 commits into
Open
nicole-graus wants to merge 12 commits into
nicole-graus wants to merge 12 commits into
Conversation
Collaborator
Author
|
/ai-review |
Codex Code ReviewNo actionable issues found in the PR changes during static review. No builds or tests were run, as requested. |
AI ReviewPR #1033 · 216 changed files
FindingsNo non-rejected structured findings were reported. Reviewer Lanes
Native Codex and Claude reviews run separately and post their own comments. They are not included in this structured provenance report. Raw lane outputs, candidates, final issues, and model metrics are uploaded as workflow artifacts. |
nicole-graus
marked this pull request as ready for review
November 17, 2026 14:25
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.
Description
Proves, instruction by instruction, that the Clean model in
formal/computes what the official RISC-V spec says.PR Size: 175 of the 217 files (~176k of ~177.8k lines) are the generated Sail model in
sail-riscv-lean/LeanRV64D/; GitHub collapses them (.gitattributes) and CI checks they match their pinned sources. The hand-written part is ~1.8k lines, mostlyformal-riscv/.What's in it
formal-riscv/: one chain of three proofs per instruction:Sail.lean: Sail'sexecute_*is a pure function (*Pure).Bridge.lean:*Pure, read as a natural, is the Clean model's function (shiftResult,ltBit,eqBit).Alu.lean: an ALU bus message with the instruction's flags carries that result, usingAlu.Guarantees.SLL/SRL/SRA(+ immediate and word versions),SLT/SLTU(+ immediate), and the conditions ofBEQ/BNE/BLT/BGE/BLTU/BGEU. 22*_alu_matches_sailtheorems, nosorry.sail-riscv-lean/: the Sail RISC-V model in Lean, generated from pinned commits ofriscv/sail-riscvandrems-project/sail(PINS,scripts/generate.sh). It replacesopencompl/sail-riscv-lean, which is no longer updated. The Sail compiler is pinned to fix(lean): split variants exceeding runtime constructor limits rems-project/sail#1823 (not merged yet), which splits theinstructiontype so it compiles on Lean v4.35.0;PINSwill move to Sail's main once it is merged..github/workflows/sail-riscv-lean.yml: regenerates the model and fails if it differs from the committed one.Not covered yet
ha,hb).Notes
formal/. Lean ≥ 4.35 rejects inductive types with more than 244 constructors (error: Error: tag for constructor 'ast.ZIMOP_MOP_RR' is too big, this is a limitation of the current runtime leanprover/lean4#8930), and the model'sinstructiontype has 361; fix(lean): split variants exceeding runtime constructor limits rems-project/sail#1823 generates it in chunks, which is why the compiler is pinned to that PR.formal-riscvis not built by CI yet.