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

Carbon axiomatization of Map is better than Silicon #761

Open
tillarnold opened this issue Dec 17, 2023 · 0 comments
Open

Carbon axiomatization of Map is better than Silicon #761

tillarnold opened this issue Dec 17, 2023 · 0 comments

Comments

@tillarnold
Copy link

tillarnold commented Dec 17, 2023

method test(m: Map[Int,Int])
    requires(range(m) == domain(m))
{
    assume forall i: Int, j: Int :: i in m && j in m ==> (i != j ==> (m[i] != m[j]))
    assert forall i: Int, j: Int :: i in m && j in m ==> (i != j ==> (m[i] != m[j]))
}

Fails to verify in Silicon but works fine in Carbon, removing the precondition makes it work also in Silicon.
We were unable to find a combination of triggers to make it work in Silicon.


@marcoeilers remarked about this on zulip that

Silicon essentially runs into Z3 non-termination here after assuming i in m && j in m when evaluating the quantifier body. That step just doesn't happen in Carbon in the same way. So I think it's more likely that the map axiomatization of both has an issue that only shows up in Silicon here.
This program essentially illustrates the step, and if you give this to Carbon, it also needs ca. 3 seconds to report an error, which is longer than it should, so there is likely a problem here:

method test(m: Map[Int,Int])
    requires(range(m) == domain(m))
{
    assume forall i: Int, j: Int :: {m[i], m[j]} i in m && j in m ==> (i != j ==> (m[i] != m[j]))
    var ip: Int
    var jp: Int

    assume ip in m && jp in m
    assert false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant