Skip to content

Add pure tests for more operators with Java module overrides - #133

Merged
lemmy merged 1 commit into
masterfrom
mku-pureTests
Oct 3, 2026
Merged

lemmy merged 1 commit into
masterfrom
mku-pureTests

Conversation

@lemmy

@lemmy lemmy commented Oct 3, 2026

Copy link
Copy Markdown
Member

Check the Java module overrides of 22 more operators exhaustively against pure TLA+ definitions over small inputs, as was done for SelectInSubSeq/SelectLastInSubSeq in #132:

  • SequencesExt: SelectInSeq, SelectLastInSeq, Contains, IsPrefix, Suffixes, RemoveFirst, RemoveFirstMatch, FoldSeq, FoldLeft, FoldRight, FoldLeftDomain, FoldRightDomain, SetToSeq
  • FiniteSetsExt FoldSet, Functions FoldFunction/FoldFunctionOnSet, BagsExt FoldBag, Bitwise shiftR, DyadicRationals Reduce (via Add and Half, since Reduce is LOCAL), IOUtils atoi, SVG PointOnLine, VectorClocks CausalOrder

Folds with an unspecified order are only compared on operators for which the order does not matter. SetToSeq and CausalOrder are defined via CHOOSE, so their results are checked for membership in the set they choose from.

Not covered: operators whose TLA+ definitions are placeholders (TRUE or an arbitrary CHOOSE), i.e. most of IOUtils, CSV, GraphViz, Statistics, and SVG, and the Json operators, which TLC's own tla2tools.jar overrides.

The tests sidestep two disagreements between overrides and their definitions:

  • PointOnLine: the override truncates towards zero whereas \div rounds down, so the results differ for negative coordinates, e.g., x = 0 to x = -1 with segment = 2 gives 0 vs. -1. The test is restricted to non-negative coordinates.
  • CausalOrder: the override fails with Cannot cast FcnRcdValue to TupleValue on a sequence represented as a function, e.g., [i \in 1..4 |-> ...]. The test passes tuple literals.

Check the overrides exhaustively against pure TLA+ definitions over small
inputs.  Folds with an unspecified order are only compared on operators
for which the order does not matter.  Operators defined via CHOOSE are
checked for membership in the set they choose from.

[Tests]

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>
@lemmy
lemmy merged commit 1a47a22 into master Oct 3, 2026
4 of 6 checks passed
@lemmy
lemmy deleted the mku-pureTests branch October 3, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant