Skip to content

Commit

Permalink
Rewrite for set membership of the powerset of a record where the reco…
Browse files Browse the repository at this point in the history
…rd has infinite co-domains.

Simplified real-world scenario:
```tla
EXTENDS Integers

VARIABLE
  \* @type: Set({ p: (Int) });
  v

TypeOK ==
  v \in SUBSET [ p: Int ]

Init ==
  v = { [p |-> 42] }

Next ==
  UNCHANGED v
```

Apalache Error:
```sh
$ apalache-mc check --inv=TypeOK APARecSub.tla
[...]
Input error (see the manual): Found a set map over an infinite set of CellTFrom(Int). Not supported.
```

Rewrite:
```tla
S \in SUBSET [a : T] ~~> \A r \in S: DOMAIN r = { "a" } /\ r.a \in T
```

Related commits, issues, PRs:
* 625a164
* 785e269

* apalache-mc#723
* apalache-mc#1627
* apalache-mc#2762

* apalache-mc#1453
* apalache-mc#1629

Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>
  • Loading branch information
lemmy committed Aug 16, 2024
1 parent 916e505 commit 024e759
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class TestExprOptimizer extends AnyFunSuite with BeforeAndAfterEach {
assert(expected == output)
}

// An optimization for set membership of the powerset of a record where the record has infinite co-domains.
test("""S \in SUBSET [a : T] ~~> \A r \in S: DOMAIN r = { "a" } /\ r.a \in T""") {
}

// optimizations for set cardinalities

test("""Cardinality(S) = 0 becomes S = {}""") {
Expand Down

0 comments on commit 024e759

Please sign in to comment.