feat(vcr-isa): AddWithCarry family + flag-free ALU + shifts + moves bridged to Sail/ASL (#242, VCR-ISA-001) - #671
Merged
Conversation
…Sail/ASL (#242, VCR-ISA-001) Extends coq/Synth/ARM/SailArmBridge.v per the spike's priority list (docs/design/vcr-isa-001-spike.md §5, items 1-2 + the moves stretch): - AddWithCarry family completed: SUB/SUBS (reg + all 4 NZCV), CMN, RSB, and ADC/SBC with the LIVE C flag as carry_in — the i64 lo/hi pair codegen primitives (ADDS;ADC / SUBS;SBC). - Flag-free ALU: AND/ORR/EOR/MVN (register), via mod-2^32 distribution over Z.land/Z.lor/Z.lxor (testbit extensionality). - Shifts: faithful Shift_C transcription (v8_base.sail:41273) with all four *_C primitives incl. shifter carry-out (builtins.sail:69-99); LSL/LSR/ASR/ROR bridged in immediate (1..31) and register (0 < UInt(R[s]) < 32) forms; amount = 0 bridged on the unsigned view. - Moves: MOV (register), MOVW, MOVT (bitfield-insert vs AND/ORR/LSL formulation, UInt(imm16) < 2^16). File now 81 Qed / 0 Admitted / 0 new axioms (round 1: 23). All quoted Sail pinned to rems-project/sail-arm @ 1bf2e5574ba9 with file:line provenance. New documented gaps 5-10 in-file; FINDING: two latent hand-model divergences from the ASL surfaced (LSR/ASR #32, register shift amounts >= 32 — unreachable from Compilation.v, WASM masks 0..31). Roadmap: VCR-ISA-001 proposed -> approved (method validated on the i32 straight-line integer core; PC executor, memory ops, RISC-V half remain). bazel test //coq:verify_proofs green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
avrabe
added a commit
that referenced
this pull request
Jul 8, 2026
…ed rules, 81 bridge Qed (#673) * chore(release): v0.36.0 — unreachable traps + sparse tables + 40 rules + 81 bridge Qed (#668/#669/#670/#671) Pin sweep 0.35.0 -> 0.36.0 + CHANGELOG. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore: fold #672 (post-exhaustion quality) into the v0.36.0 changelog — merged ahead of the tag Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Round 2 of VCR-ISA-001 (epic #242), executing the spike's own priority list (
docs/design/vcr-isa-001-spike.md§5, items 1–2 plus the moves stretch) with the exact transcription + bridge-lemma pattern PR #660 established: verbatim-quoted Sail execute clauses with file:line provenance (pin: rems-project/sail-arm @1bf2e5574ba9, arm-v9.4-a), hand transcription, and a Qed bridge theorem provingexec_instr≡ the transcription on the full observable state.coq/Synth/ARM/SailArmBridge.v: 81 Qed / 0 Admitted / 0 new axioms (round 1: 23).Op classes bridged
ADDS;ADC/SUBS;SBCpair-codegen primitives)Z.land/lor/lxor, testbit extensionality)Shift_Ctranscription (v8_base.sail:41273) + all four*_Cprimitives incl. shifter carry-out (builtins.sail:69–99)UInt(R[s]<7:0>)0 < UInt(R[s]) < 32; amount = 0 bridged on the unsigned viewUInt(imm16) < 2^16Documented gaps (in-file, gaps 5–10)
setflags=false only for ALU/shifts/moves (no ANDS/LSLS/MOVS in ArmSemantics.v — carry-out transcribed, nothing to bridge it to); shift 32 and register amounts ≥ 32 excluded; BIC absent from our model; MOVW carries pre-expanded imm32; RRX out of scope.
Finding (the bridge earning its keep): two latent divergences between the hand-written model and the ASL surfaced — LSR/ASR #32 (our mod-32 masking computes shift-by-0 where ARM zero/sign-fills) and register-controlled amounts ≥ 32 (ARM reads the low byte). Neither is reachable from Compilation.v (WASM masks shift amounts to 0..31), so they are latent model bugs, not miscompiles — exactly the class VCR-ISA-001 exists to surface.
Cost vs the spike's estimate
~Half a day wall-clock for six-plus op classes, vs the spike's 0.5–1 day per class: the flag-machinery amortization held exactly (SUB's flags ARE CMP's flags — one
exact; ADC/SBC needed two ~10-line mod lemmas). Genuinely new machinery: the three bitwise mod-distribution lemmas and the Shift_C transcription.Roadmap
VCR-ISA-001proposed → approved inartifacts/verified-codegen-roadmap.yaml: two landed increments validate the revised (per-instruction transcribe-and-bridge) criterion on the i32 straight-line integer core. Explicitly NOT implemented: the PC-indexed executor (the trap-guard admits — this item's core motivation), MUL/UMULL/CLZ/RBIT, memory ops, and the whole RISC-V half.Verification
bazel test //coq:verify_proofs— green locally (hermetic Rocq 9 toolchain)cargo test -p synth-cli --test frozen_codegen_bytes— 10/10 (coq-only change, formality)cargo fmt --check/cargo clippy --workspace --all-targets -- -D warnings— clean (no Rust touched)Refs #242.
🤖 Generated with Claude Code