Giter Club home page Giter Club logo

Comments (1)

fortunac avatar fortunac commented on August 23, 2024

The rule for structured loops is as follows:

      {I && cond} body  { I }
----------------------------------
{ I } while(cond) body {I && !cond}

However, to be of any use in a WP setting, it needs to be paired with the weakening rule:

{ P' } p { Q' }    P => P', Q' => Q valid
-----------------------------------------
               { P } p { Q }

In practice, we combine those rules in one to produce:

{ I && cond} body { I }    I && !cond => Q valid
-----------------------------------------------------
            { I } while(cond) body { Q }

If we're doing WP, and a similar rule if we do Strongest Postconditions.

Unfortunately, in BIR we do not have structured loops. It is more difficult to formulate a simple rule for WP for the unstructured setting.

What I propose:

Reconstruct the loop structure for "simple" loops, which I describe as loops for which the SCC has a dominator and a postdominator.

For such loops, we compute the WP in the following manner:

  • WP(l) = I, where i is the last instruction of the post-dominating block for the SCC. We create the side condition I => P where P is the current post-condition.

  • We then get WP(e) = I' for the first instruction of the dominating block for the SCC, and we add the side condition I' => I.

I think this is sound for simple loops, but I'd be happy if someone could chime in with a confirmation or infirmation (is that a word?).

Implementation therefore requires 2 steps:

  • Adding side conditions to env, to be checked at precondition checking time. In fact, I wonder if we should just be returning a set of VCCs.

  • Adding hooks for looking up invariants and generating the VCCs when entering and leaving an SCC.

from cbat_tools.

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.