Skip to content

Make the AntiFunction override total on non-injective functions - #135

Merged
lemmy merged 2 commits into
masterfrom
mku-antifunction
Oct 4, 2026
Merged

lemmy merged 2 commits into
masterfrom
mku-antifunction

Conversation

@lemmy

@lemmy lemmy commented Oct 3, 2026

Copy link
Copy Markdown
Member

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]

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>
@lemmy
lemmy requested a balanced review from Copilot October 3, 2026 23:14
@lemmy lemmy added the bug Something isn't working label Oct 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation matches normalized CHOOSE ordering and is covered by comprehensive regression tests.

Review effort: Balanced
Findings: None

@lemmy
lemmy marked this pull request as ready for review October 4, 2026 02:41
@lemmy
lemmy requested a balanced review from Copilot October 4, 2026 02:41
@lemmy
lemmy merged commit 78b98ae into master Oct 4, 2026
6 of 8 checks passed
@lemmy
lemmy deleted the mku-antifunction branch October 4, 2026 02:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation matches the TLA+ definition and is covered by comprehensive regression tests.

Review effort: Balanced
Findings: None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Development

Successfully merging this pull request may close these issues.

2 participants