Skip to content

[WIP] progress on rewrite lifting#866

Draft
math-fehr wants to merge 3 commits into
mainfrom
math-fehr/wip-lifting-list
Draft

[WIP] progress on rewrite lifting#866
math-fehr wants to merge 3 commits into
mainfrom
math-fehr/wip-lifting-list

Conversation

@math-fehr

Copy link
Copy Markdown
Collaborator

This is the current status of proving the lifting between the soundness of local rewrites to module refinements

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VeIR Benchmarks

Details
Benchmark suite Current: e0e8f6e Previous: 7121200 Ratio
add-fold-worklist/create 1891000 ns (± 87617) 2183000 ns (± 82011) 0.87
add-fold-worklist/rewrite 3278000 ns (± 83052) 3979000 ns (± 44215) 0.82
add-fold-worklist-local/create 1987000 ns (± 97998) 2203000 ns (± 206240) 0.90
add-fold-worklist-local/rewrite 10131000 ns (± 185801) 3322500 ns (± 149674) 3.05
add-zero-worklist/create 1811000 ns (± 90262) 2193000 ns (± 110361) 0.83
add-zero-worklist/rewrite 2103000 ns (± 43738) 2529500 ns (± 48039) 0.83
add-zero-reuse-worklist/create 1582000 ns (± 61066) 1793000 ns (± 59231) 0.88
add-zero-reuse-worklist/rewrite 1806000 ns (± 64867) 2090000 ns (± 10991) 0.86
mul-two-worklist/create 1900000 ns (± 120241) 2213000 ns (± 95908) 0.86
mul-two-worklist/rewrite 4537500 ns (± 184953) 5671000 ns (± 163587) 0.80
add-fold-forwards/create 1939000 ns (± 94028) 2212000 ns (± 99204) 0.88
add-fold-forwards/rewrite 2497000 ns (± 23480) 3043000 ns (± 35886) 0.82
add-zero-forwards/create 1932000 ns (± 81571) 2229000 ns (± 105996) 0.87
add-zero-forwards/rewrite 1682000 ns (± 54948) 1950500 ns (± 79487) 0.86
add-zero-reuse-forwards/create 1514000 ns (± 74740) 1815000 ns (± 72102) 0.83
add-zero-reuse-forwards/rewrite 1337000 ns (± 12806) 1544000 ns (± 24238) 0.87
mul-two-forwards/create 1947000 ns (± 93371) 2182000 ns (± 60400) 0.89
mul-two-forwards/rewrite 2931000 ns (± 102233) 3631000 ns (± 79364) 0.81
add-zero-reuse-first/create 1611500 ns (± 88661) 1811000 ns (± 71387) 0.89
add-zero-reuse-first/rewrite 11000 ns (± 1846) 8000 ns (± 1404) 1.38
add-zero-lots-of-reuse-first/create 1590000 ns (± 86049) 1884000 ns (± 71613) 0.84
add-zero-lots-of-reuse-first/rewrite 695000 ns (± 51005) 774000 ns (± 37689) 0.90

This comment was automatically generated by workflow using github-action-benchmark.

@math-fehr math-fehr force-pushed the math-fehr/wip-lifting-list branch 28 times, most recently from cfce77f to 4b27368 Compare June 20, 2026 01:11
@math-fehr math-fehr force-pushed the math-fehr/wip-lifting-list branch from 4b27368 to 3bdb34f Compare June 21, 2026 15:05
@math-fehr math-fehr force-pushed the math-fehr/wip-lifting-list branch 4 times, most recently from e8a1632 to f45dc66 Compare June 30, 2026 01:51
@math-fehr math-fehr force-pushed the math-fehr/wip-lifting-list branch 7 times, most recently from 87f1c6e to 353f489 Compare July 14, 2026 02:54
These lemmas are similar to the ones about `setResultValues` in that they show preservation of `EquationLemmaAt` and `DefinesDominating`.

These required additional simple lemmas, and additional axioms about dominance.
@math-fehr math-fehr force-pushed the math-fehr/wip-lifting-list branch 2 times, most recently from 4058043 to ecc835e Compare July 14, 2026 22:12
This is similar to `BlockPtr.getArguments`, but maps it to grab only the type.
@math-fehr math-fehr force-pushed the math-fehr/wip-lifting-list branch 2 times, most recently from dfeb85a to 241c603 Compare July 15, 2026 15:31
…lockIn')

Add RewrittenAt.of_fromLocalRewrite connecting the concrete LocalRewritePattern
driver to the abstract RewrittenAt relation. Proves the keystone reduction
(driver's worklist-threaded forIn loops reduce to a pure WfRewriter foldlM),
the operationList split helper, a generic foldlM invariant-transport lemma, the
insertOp/replaceValue/eraseOp ctx bridges, and the blockIn'/srcList/newValuesSize/
opNotFunction fields. Remaining RewrittenAt fields are scoped sorries.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

feat(soundness): prove survives/opErased/blocksInBounds/regionsInBounds fields

Add WithCreatedOps + eraseOp survival helpers (hSurviveOp/Block/Region) and use
them to discharge the bounds-preservation fields of RewrittenAt.of_fromLocalRewrite.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>


feat(soundness): prove newOpsFresh and mappingFixesNonResults fields

Add hOpBnd (bidirectional non-op bounds across the rewrite) to transport ReturnOps
freshness; mappingFixesNonResults is the else-branch of rewriteMapping.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>


feat(soundness): prove mapNonResultsInBounds field

Add hSurviveVal (value survival across folds + eraseOp when the value's owner is
not op) and discharge mapNonResultsInBounds via getResults! membership.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>


docs(soundness): categorize remaining RewrittenAt sorries

Mark which fields need an extra pattern hypothesis (newValuesInBounds,
mapResultsInBounds, newValuesAreResults, newCtxDom, newCtxVerif) vs deep
operationList/GetSet plumbing through the foldlM (tgtList, otherBlocks, frame,
parentOps, blockArgsPreserved, opRegionsPreserved, regionFirstBlockPreserved).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>


Done refactoring with isRefinedByAt


A few less fields


Remove two sorries from lifting lemma


remove bad constraint


One less sorry


One less sorry


One less sorry


Last sorry


Removing sorries from fromLocalRewrite


One less argument in fromLocalRewrite soundness


Check for parent in rewriter


Preservation of parent


Thread EquationLemmaAt


Step 2 of last proof


Magic


Done modulus 3 axioms


Add axioms


Add global proof about GreedyRewritePattern


Finish proof
@math-fehr math-fehr force-pushed the math-fehr/wip-lifting-list branch from 241c603 to 94c59f4 Compare July 15, 2026 15:54
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