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

479 do not backtranslate fancy sorts in get-model #563

Merged
merged 5 commits into from
Mar 27, 2024

Conversation

jberthold
Copy link
Member

@jberthold jberthold commented Mar 27, 2024

Values of any sort other than SortBool and SortInt cannot currently be back-translated from the SMT representation (all sorts unknown to the solver are opaque). In particular, this is true for Map-sorted values (which are used frequently in EVM).

  • Do not attempt to back-translate values of sorts other than SortBool and SortInt
  • but still include the related SMT variables in the get-values requestl;
  • and indicate untranslated variables by adding VAR = VAR to the returned substitution.

As shown in the added integration test, there are cases where the Map-sorted value is relevant, but cannot currently be returned. We might consider modeling Maps specifically as arrays in the SMT solver in the future.

Fixes runtimeverification/kontrol#479

Comment on lines +220 to +221
untranslated =
Map.mapWithKey (const . Var) untranslatableVars
Copy link
Member Author

Choose a reason for hiding this comment

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

Unsure about this but I thought it might be helpful to indicate in the response that some potentially-relevant variables are not included.

@jberthold jberthold marked this pull request as ready for review March 27, 2024 03:27
@palinatolmach
Copy link

Thanks @jberthold, will try it out in a bit!

@palinatolmach
Copy link

palinatolmach commented Mar 27, 2024

The result looks great to me! I just ran Kontrol with this version of Booster on the test used in runtimeverification/kontrol#479, and here's the counterexample I'm getting

  Path condition:
    { true #Equals VV0_from_114b9705:Int ==Int 0 }
  Model:
    VV2_amount_114b9705 = 0
    TIMESTAMP_CELL = 0
    ORIGIN_ID = 10
    CALLER_ID = 10
    CONTRACT_ID = 2
    VV0_from_114b9705 = 0
    NUMBER_CELL = 0
    VV1_to_114b9705 = 1
    ?STORAGE = ?STORAGE:Map

which I think looks great, and it should be clear to the user that we don't concretize ?STORAGE values.

I'll leave it to @goodlyrottenapple and @geo2a to approve :)

@rv-jenkins rv-jenkins merged commit 248f67b into main Mar 27, 2024
5 checks passed
@rv-jenkins rv-jenkins deleted the 479-do-not-backtranslate-fancy-sorts branch March 27, 2024 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to backtranslate atom during model generation
5 participants