Repository navigation
Make the AntiFunction override total on non-injective functions - #135
Merged
Merged
Conversation
The override swapped domain and values, which fails with "occurs multiple times in the function domain" if f maps two elements to the same value. Like TLC's CHOOSE in the TLA+ definition, map each value to the first such element of the normalized DOMAIN f. Fixes tlaplus/model-checker-hardening Github issue #197 tlaplus/model-checker-hardening#197 [Bug] Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches normalized CHOOSE ordering and includes comprehensive regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Makes AntiFunction handle non-injective functions consistently with TLC’s CHOOSE semantics.
Changes:
- Selects the first normalized-domain preimage for duplicate values.
- Expands coverage to non-injective functions.
| File | Description |
|---|---|
modules/tlc2/overrides/Functions.java |
Deduplicates inverse-domain values while preserving the correct witness. |
tests/FunctionsTests.tla |
Adds exhaustive and targeted non-injective cases. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Explain each step of the override in terms of the TLA+ definition, and trace a non-injective function through the intermediate arrays. [Documentation] Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>
lemmy
force-pushed
the
mku-antifunction
branch
from
October 3, 2026 23:40
a4f4889 to
8df3880
Compare
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.
The override swapped domain and values, which fails with "occurs multiple times in the function domain" if f maps two elements to the same value. Like TLC's CHOOSE in the TLA+ definition, map each value to the first such element of the normalized DOMAIN f.
Fixes tlaplus/model-checker-hardening Github issue #197 tlaplus/model-checker-hardening#197
[Bug]