Open hjorthjort opened 4 years ago
This was discovered on commit 96f3642e6e3917d38bf827aa5a8f80dc97030542 on the ewasm-semantics repository
From directory ewasm-semantics/verification/wrc20
, the following command: make test KPROVE_OPTS="--haskell-backend-command 'kore-repl --repl-script repl-script'"
What does the associated K rule look like?
What does the associated K rule look like?
syntax PlainInstr ::= "call" Index
// ----------------------------------
rule <k> call TFIDX => ( invoke FADDR ) ... </k>
<curModIdx> CUR </curModIdx>
<moduleInst>
<modIdx> CUR </modIdx>
<funcIds> IDS </funcIds>
<funcAddrs> ... #ContextLookup(IDS , TFIDX) |-> FADDR ... </funcAddrs>
...
</moduleInst>
Hmmmm, I wonder if it's splitting on the #ContextLookup
function evaluation, since that's the only function evaluation in that rule. Otherwise everything looks like normal Map
lookups.
Though it's also a nested Map
lookup, so maybe the haskell backend doesn't handle the nested case very well. What do the resulting states have different about them?
That's probably what is going on. Although the lookups in question are using TFIDX
that is definitely in IDS
, either in the concrete base map, or in a Map:update
somewhere. It kind of seems like the equality checks are failing, i.e., it can't decide equality for the TFIDX
and any of the keys.
I'm wondering if it will help adding a smtlib
for #ContextLookup
.
Another thing that might be tripping up the backend is that the rules for #ContextLookup
are in different modules, on in data.md
and one in wasm-text.md
.
Well, I think what's more likely is that the backend is not fully evaluating #ContextLookup
before trying to do the lookup. You can check if it's the case by sequencing the rules some more and seeing if you get the same state splitting:
rule <k> call TFIDX => #call #ContextLookup(IDS, TFIDX) ... </k>
<curModIdx> CUR </curModIdx>
<moduleInst>
<modIdx> CUR </modIdx>
<funcIds> IDS </funcIds>
...
</moduleInst>
rule <k> #call FID => ( invoke FADDR ) ... </k>
<curModIdx> CUR </curModIdx>
<moduleInst>
<modIdx> CUR </modIdx>
<funcIds> IDS </funcIds>
<funcAddrs> ... FID |-> FADDR ... </funcAddrs>
...
</moduleInst>
A more general solution to this would be to find a way to eliminate #ContextLookup
altogether (assuming the above attempt works).
I'll try that.
Yes, ideally #ContextLookup
would be part of a pre-processing, converting from the text format to the basic format.
The below screenshot of the execution graph in the Haskell backend shows the splitting at axiom 112, which is
call
. The splitting occurs in node 94 and 111.This is when calling the
"main"
function ofwrc20
after the module has been loaded.Axiom 112