Repository navigation
Proof steps: two sets in a row on one map - #1999
Merged
Merged
Conversation
Two new kernel rules for map equality after two writes: map.set.set_same (the second write under the same key wins) and map.set.set_other (writes under keys that differ can be put in either order). The producer puts such writes in one order, so two maps built by the same writes in another order meet; where it does not know whether two Int keys differ, it splits on it. Lean checks each step with a lemma of the map model; the order swap is used only for key types whose order the model states (Int, String, Bool and tuples of them). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.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.
Two new kernel rules for the equality of maps after two writes:
map.set.set_same:Map.set(Map.set(m, k, v), k, w) = Map.set(m, k, w)map.set.set_other: whenk != k2,Map.set(Map.set(m, k, v), k2, w) = Map.set(Map.set(m, k2, w), k, v)The producer puts two writes under different keys in a single order, so two maps built from the same writes in a different order end up equal. When it does not know whether two Int keys differ, it splits into cases on it. Lean checks each step against a lemma of the map model (
AverMap.step_set_set_same/step_set_set_other). The swap is used only for key types whose order the Lean model states (Int, String, Bool and tuples of them). For record keys the law stays outside the steps (there is a test for this).This is the step needed to prove that counting is order-independent (
bump(bump(c, a), b) = bump(bump(c, b), a), thentallyover a reversed list). Part of #1997.Tests: new laws in
tests/fixtures/proof_steps/maps.av, checked by both kernels and by Lean, with mutations that swap the rules. The map differential test covers both rules on the VM, on wasm-gc and in the Lean model.steps_ratchetshows no loss.Changelog: Proofs can now show that two writes to a map under different keys give the same map in either order, and that a second write under the same key wins.
🤖 Generated with Claude Code