GithubHelp home page GithubHelp logo

Comments (8)

ehildenb avatar ehildenb commented on July 20, 2024

In the run_proof function in script kevm, you can change K_OPTS=-Xmx5G to a lower amount than 5G to make it fail sooner (this is the memory allocated to the JVM before it will die).

When you get missing SMTLib translation errors (eg for #memoryUsageUpdate), you can try adding the attribute smtlib(memoryUsageUpdate) to the production for #memoryUsageUpdate. It will give "uninterpreted function" semantics to that production when making queries to Z3.

When the other people working on proving things with K are going about it, they usually fire up the prover in IntelliJ and step through debug points to have access to state information that the prover is holding in memory. It' not a very good approach user-experience wise :/

Another option is passing the --debug flag to the ./kevm prove path-to-spec.k --debug command. It may print out more information about queries being passed to Z3 and such.

I'm going to leave this issue open so that @daejunpark and @iustines have a chance to weigh in and provide advice about how to prove things.

from evm-semantics.

daejunpark avatar daejunpark commented on July 20, 2024

There are many reasons for the out of memory, and I cannot pin-point one of them without looking at the spec.

As a general advice of debugging the spec (and k prover), here is a pointer to some important part of source code of the kprover so that you can navigate using the IntelliJ debugger.

from evm-semantics.

MrChico avatar MrChico commented on July 20, 2024

@ehildenb how about if I do know the SMTLib translation of a function? For example, I get the error message:

[Warning] Critical: missing SMTLib translation for _^Int__INT (missing SMTLib translation for _^Int__INT)

and would like to tell Z3 that this should be translated to exponentiation?

from evm-semantics.

ehildenb avatar ehildenb commented on July 20, 2024

@MrChico we have an "smt-prelude". In the EVM directory, look at .build/k/k-distribution/include/z3. The file basic.smt2 shows what a basic SMT prelude can look like (in Z3 syntax).

You can specify your smt prelude using --smt_prelude PATH/TO/FILE.smt2. I can't find what the default value is, but I think it was basic.smt2 IIRC. @daejunpark can you provide more info?

from evm-semantics.

ehildenb avatar ehildenb commented on July 20, 2024

But basically, you can have your own prelude which you specify for KEVM.

I think though, you should be able to achieve the same thing using the concrete attribute on the rules which are causing trouble, and adding lemmas in K directly. You can look at file tests/proofs/resources/lemmas.md for an example of an abstraction (eg. nthbyteof). Basically, you block usage of certain rules in symbolic mode by adding the concrete attribute, then provide other rules which give the correct symbolic semantics to use for simplification.

Note that these extra lemmas are never passed to Z3 directly, the simplification is done in K itself. This has the advantage that it will be slightly quicker, and in the same readable format as the rest of the definition.

If you do come up with good abstractions + lemmas for more of the operators in KEVM which make proofs faster/more robust, I'm happy to add them to mainline KEVM.

Also note, the missing SMTLIB translation errors look scary, but they aren't as bad as you might think. Have you added the --debug flag to your invocation of krun? That will print out the actual queries being made to Z3, which can be very informative.

from evm-semantics.

norbeyandresg avatar norbeyandresg commented on July 20, 2024

@MrChico I have the same error

[Warning] Critical: missing SMTLib translation for _^Int__INT (missing SMTLib translation for _^Int__INT)

could you solve it?

from evm-semantics.

MrChico avatar MrChico commented on July 20, 2024

@norbeyandresg I've not yet solved that particular warning, but this will not cause z3 to throw. If your issue is still that (error "line 20 column 206: unknown function/constant smt_seq_elem"), then you should be able to resolve it by adding that smt-prelude as described above. The smt_seq_elem function is defined in evm-semantics/.build/k/k-distribution/include/z3/basic.smt2

from evm-semantics.

norbeyandresg avatar norbeyandresg commented on July 20, 2024

@MrChico I ran the prove whit the smt-prelude but the the flag seems doesn't work because I still get the same error. I'm using this: ./kevm prove tests/proofs/resources/pow-of-two-spec.k --smt_prelud .build/k/k-distribution/include/z3/basic.smt2. Am I doing something wrong?

from evm-semantics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.