Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] CHOOSE over sets of functions of functions #1398

Open
konnov opened this issue Feb 23, 2022 · 1 comment
Open

[FEATURE] CHOOSE over sets of functions of functions #1398

konnov opened this issue Feb 23, 2022 · 1 comment
Labels
bug product-owner-triage This should be triaged by the product owner

Comments

@konnov
Copy link
Collaborator

konnov commented Feb 23, 2022

This discussion shows an example of using CHOOSE for defining a hash function.

Here is an MWE:

--------------- MODULE TestHash --------------                                   
EXTENDS Integers

BitString == [1..6 -> {0,1}]

AllowedStrings == {"a", "b", "c", "d", "e"}

\* @type: (Str -> (Int -> Int)) => Bool;
IsInjective(f) ==
    \A a,b \in DOMAIN f : f[a] = f[b] => a = b

hash ==
    CHOOSE i \in [AllowedStrings -> BitString]:
        IsInjective(i)

Init == TRUE

Next == TRUE

Inv == hash["a"] /= hash["b"]
==============================================

Apalache fails when rewriting the filter expression:

apalache-mc check --inv=Inv TestHash.tla
...
State 0: Checking 1 state invariants                              I@08:42:24.563
(Please report an issue at: [https://github.com/informalsystems/apalache/issues],scala.NotImplementedError: A set filter over FinFunSet[FinSet[str], FinFunSet[FinSet[Int], FinSet[Int]]] is not implemented)
Unhandled exception                                               E@08:42:24.581
scala.NotImplementedError: A set filter over FinFunSet[FinSet[str], FinFunSet[FinSet[Int], FinSet[Int]]] is not implemented
	at at.forsyte.apalache.tla.bmcmt.rules.SetFilterRule.apply(SetFilterRule.scala:32)
	at at.forsyte.apalache.tla.bmcmt.SymbStateRewriterImpl.rewriteOnce(SymbStateRewriterImpl.scala:336)
	at at.forsyte.apalache.tla.bmcmt.SymbStateRewriterImpl.doRecursive$1(SymbStateRewriterImpl.scala:368)
	at at.forsyte.apalache.tla.bmcmt.SymbStateRewriterImpl.rewriteUntilDone(SymbStateRewriterImpl.scala:402)
	at at.forsyte.apalache.tla.bmcmt.rules.ChooseRule.apply(ChooseRule.scala:45)
...

At least, we should produce an error message that this feature is not supported yet.

@konnov konnov added the bug label Feb 23, 2022
@konnov konnov added the product-owner-triage This should be triaged by the product owner label Jul 13, 2022
@thpani
Copy link
Collaborator

thpani commented Oct 19, 2023

Related: #2762

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug product-owner-triage This should be triaged by the product owner
Projects
None yet
Development

No branches or pull requests

2 participants