-
Notifications
You must be signed in to change notification settings - Fork 2
SimplifyCFG pass: block merging proofs #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
charles-cooper
wants to merge
13
commits into
main
Choose a base branch
from
simplify_cfg
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Proof structure for the SimplifyCFG pass following phi_elimination pattern: - cfgTransformScript.sml: transformation definitions (merge_blocks, thread_jump) - cfgWellFormedScript.sml: well-formedness conditions - cfgBlockScript.sml: block-level correctness theorems - cfgFunctionScript.sml: function-level correctness theorems Main theorems (sketched with cheat): - merge_blocks_execution: merged block equiv to sequential execution - simplify_cfg_merge_correct: block merge preserves semantics - simplify_cfg_thread_correct: jump threading preserves semantics - simplify_cfg_steps_correct: sequence of steps preserves semantics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add helper lemmas for CFG simplification proofs: - eval_operand_replace_label: label replacement doesn't affect eval_operand - replace_label_inst_opcode/output: label replacement preserves opcode/output - exec_binop/unop/modop_replace_label: exec functions ignore label changes Prove replace_label_inst_preserves_step showing that for non-JMP/JNZ/PHI instructions, label replacement doesn't change step_inst semantics. Also fix proofs in cfgWellFormedScript.sml and cfgTransformScript.sml: - all_distinct_map_filter, remove_block_unique_labels - map_preserves_unique_labels - lookup_block_remove, lookup_block_map 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add data_equiv definition (state equiv ignoring control flow fields) - Add state_equiv_merge and result_equiv_merge for block merging - Prove data_equiv helper lemmas: refl, sym, trans - Prove eval_operand_data_equiv, update_var_data_equiv - Prove mload/mstore/sload/sstore/tload/tstore_data_equiv - Prove halt_state/revert_state/next_inst_data_equiv - Prove exec_binop/unop/modop_data_equiv - Prove step_inst_data_equiv for non-PHI/non-branch instructions - Add step_in_block_data_equiv_no_phi (cheated, structure verified) - Fix inst_output -> inst_outputs in replace_label_inst_outputs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add jump_to_data_equiv: JMP preserves data_equiv - Add next_inst_data_equiv_full: next_inst preserves data_equiv and control flow - Add step_inst_preserves_ctrl: non-JMP/JNZ instructions preserve vs_current_bb/vs_inst_idx - Add step_inst_jmp_data_equiv: JMP preserves data_equiv with control flow - Add step_inst_jnz_data_equiv: JNZ preserves data_equiv with control flow - Add non_jmp_jnz_terminator_not_ok: non-JMP/JNZ terminators never return OK - Complete proof of step_in_block_data_equiv_no_phi 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
This theorem shows that running the same no_phi block from two data-equivalent states produces result_equiv_merge results. Key proof technique: - Complete induction on remaining instructions - Uses step_in_block_data_equiv_no_phi for each step - Handles OK/OK case with subcases for halted and terminator 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
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
run_block_data_equiv_no_phitheorem proving that running the same no-phi block from data-equivalent states produces equivalent resultsmerge_blocks_executionstep_in_block_data_equiv_no_phi,data_equivinfrastructureTest plan
VFMDIR=/home/ubuntu/verifereum Holmake --qofpasses🤖 Generated with Claude Code