GithubHelp home page GithubHelp logo

Comments (14)

quiveringlemon avatar quiveringlemon commented on August 16, 2024

(exception to 3rd para above: the model checker is in fact allowed to find a trace which covers the same LOC as a previously found trace but only in the case when one is a failing trace and the other is a passing trace - this allows us to that rows of the matrix which are otherwise identical apart from one being passing and one being failing).

from cbmc.

quiveringlemon avatar quiveringlemon commented on August 16, 2024

Also - how is it possible that there is a passing trace in the unsimplified matrix covers only one element, but all passing traces in the simplified matrix cover more than one element?

from cbmc.

theyoucheng avatar theyoucheng commented on August 16, 2024

from cbmc.

theyoucheng avatar theyoucheng commented on August 16, 2024

from cbmc.

quiveringlemon avatar quiveringlemon commented on August 16, 2024

WRT to the unwindings issue: I have updated FCBMC and the symptom of the problem remains - insertion sort is still 14 secs - this suggests to me that the problem hasn't been fixed - if FCBMC really is making fewer calls to the model checker (It appears there need to be at least ten less calls) we'd expect some reduction to this time. So, just to be clear - have you have fixed this problem by ensuring the model checker is not being called to find the ten erroneous executions of the program originally discussed, or is it simply the case that these original traces are now no longer reported but are still in fact generated by the model checker?

Just to emphasise the importance of this problem - Reporting 14 seconds for a such a tiny program (24 lines!) is a big problem, and undercuts the main claim of any paper (that fault localisation adds negligible time cost to CBMC), especially when CBMC takes under a second to generate 1 trace. It also doesn't seem to me to make much intuitive sense to me - there are only 4 traces reported, and around 3 branches of the program itself, which means a maximum of (2^3) 8 calls to a model checker to check for all failing traces (and an additional 8 to find all possible passing traces). Obviously if the problem hasn't been solved as per the solution above, and the model checker is finding different executions on different paths of the unwound program (unwound to lvl 4) then it can potentially be searching overs hundreds of different paths which is precisely what we want to avoid.

Another test is as follows: As there are only 4 possible executions of the program wrt the final matrix, we would expect FCBMC to work easily with 100 unwindings (in the same way as CBMC works almost instantly with 100 unwindings) - however this isn't happening - suggesting the original problem hasn't been fixed. Can you elaborate on how FCBMC was changed to solve the problem please?

from cbmc.

quiveringlemon avatar quiveringlemon commented on August 16, 2024

WRT to the passing trace - i don't really understand what is going on here, but so long as the model checker never generates an execution which is not reported by the matrix (this is an extremely important condition required by the algorithm and efficiency considerations), then it is fine. Can we be assured that this is actually the case?

from cbmc.

quiveringlemon avatar quiveringlemon commented on August 16, 2024

I've just had a look at the merge function in your code, if i understand what is going on here all that is going on is that traces that have been generated by the model checker have been merged. However that's the wrong solution and precisely what we want to avoid. The correct solution is to not call the model checker for these traces at all. In short, nothing should require merging.

from cbmc.

quiveringlemon avatar quiveringlemon commented on August 16, 2024

WRT kundu2. My output is as follows (the fault is 428), so is quite far down the list. This must mean our outputs are different or you have a different buggy line, what is your output?

** Most likely fault location:
Fault localization scores:
[error.assertion.1]: Single Bug Optimal Fault Localization
[score: 1.71429] ##file kundu2_unsafe.cil.c line 75 function P_1
[score: 1.66667] ##file kundu2_unsafe.cil.c line 133 function P_2
[score: 1.42857] ##file kundu2_unsafe.cil.c line 71 function P_1
[score: 1.42857] ##file kundu2_unsafe.cil.c line 82 function P_1
[score: 1.38095] ##file kundu2_unsafe.cil.c line 129 function P_2
[score: 1.38095] ##file kundu2_unsafe.cil.c line 140 function P_2
[score: 1.19048] ##file kundu2_unsafe.cil.c line 475 function activate_threads
[score: 1.19048] ##file kundu2_unsafe.cil.c line 439 function reset_time_events ##file kundu2_unsafe.cil.c line 444 function reset_time_events ##file kundu2_unsafe.cil.c line 449 function reset_time_events
[score: 1.19048] ##file kundu2_unsafe.cil.c line 268 function is_C_1_triggered ##file kundu2_unsafe.cil.c line 269 function is_C_1_triggered
[score: 1.19048] ##file kundu2_unsafe.cil.c line 483 function activate_threads
[score: 1.19048] ##file kundu2_unsafe.cil.c line 267 function is_C_1_triggered
[score: 1.19048] ##file kundu2_unsafe.cil.c line 176 function is_P_2_triggered ##file kundu2_unsafe.cil.c line 177 function is_P_2_triggered
[score: 1.19048] ##file kundu2_unsafe.cil.c line 467 function activate_threads
[score: 1.19048] ##file kundu2_unsafe.cil.c line 332 function exists_runnable_thread
[score: 1.19048] ##file kundu2_unsafe.cil.c line 226 function C_1 ##file kundu2_unsafe.cil.c line 227 function C_1
[score: 1.19048] ##file kundu2_unsafe.cil.c line 235 function C_1 ##file kundu2_unsafe.cil.c line 236 function C_1 ##file kundu2_unsafe.cil.c line 237 function C_1 ##file kundu2_unsafe.cil.c line 238 function C_1 ##file kundu2_unsafe.cil.c line 241 function C_1 ##file kundu2_unsafe.cil.c line 26 function read_data
[score: 1.19048] ##file kundu2_unsafe.cil.c line 108 function is_P_1_triggered ##file kundu2_unsafe.cil.c line 109 function is_P_1_triggered
[score: 1.19048] ##file kundu2_unsafe.cil.c line 427 function fire_time_events ##file kundu2_unsafe.cil.c line 428 function fire_time_events ##file kundu2_unsafe.cil.c line 429 function fire_time_events ##file kundu2_unsafe.cil.c line 557 function start_simulation

from cbmc.

theyoucheng avatar theyoucheng commented on August 16, 2024

from cbmc.

theyoucheng avatar theyoucheng commented on August 16, 2024

from cbmc.

quiveringlemon avatar quiveringlemon commented on August 16, 2024

That's good news about kundu - my results are similar (the version of kundu i gave you is annotated and different to mine a tiny bit).

from cbmc.

quiveringlemon avatar quiveringlemon commented on August 16, 2024

So we can discuss this tomorrow, but I've just done a lengthy analysis of FCBMC and it's time inefficiency problem with insert_sort. I decided to compare FCBMC against a brute force manual check in which i manually generated each possible failing/passing trace by making individual calls to CBMC... the results along with the program I used are pasted below:

// REPORT: In theory the FCBMC implementation will be more efficient than a brute force algorithm in which all possible paths are checked for (this is because in theory it is clever about how it calls the model checker and uses every trace which the model checker returns in the matrix). Consequently, FCBMC should outperform a brute force algorithm on insert_sort. So I did a manual check- calling CBMC to check whether a given path was satisfiable and passing/failing for all possible paths. I did this as follows: to generate a failing trace I added the following conditional expressions (below) before the assertion (meaning a failing trace would only be generated if it covered the specified path). To generate a passing trace i did a similar thing but added ! to the assertion statement (negating the specification). I have listed the conditions, along with the time it took for CBMC to come back with its response below. Calling CBMC to do this brute force task took a cumulative 11.424 seconds, which is several seconds quicker than FCBMC (both approaches generate the same matrix - see below). There is consequently something seriously wrong in the implementation of FCBMC - not only is the single bug data algorithm guaranteed to have a much lower complexity than brute force, brute force will in practice be additionally slower because it has to unwind the program an additional 32 times to FCBMC.

// conditional expressions for FAILING TRACES, following by time in secs. - means it generated a failing trace.
// (C1 == 1 && C2 == 1 && C3 == 1 && C4 == 1), 0.660 -
// (C1 == 1 && C2 == 1 && C3 == 1 && C4 == 0), 0.796
// (C1 == 1 && C2 == 1 && C3 == 0 && C4 == 1), 0.720
// (C1 == 1 && C2 == 1 && C3 == 0 && C4 == 0), 0.848
// (C1 == 1 && C2 == 0 && C3 == 1 && C4 == 1), 0.400
// (C1 == 1 && C2 == 0 && C3 == 1 && C4 == 0), 0.392
// (C1 == 1 && C2 == 0 && C3 == 0 && C4 == 1), 0.384
// (C1 == 1 && C2 == 0 && C3 == 0 && C4 == 0), 0.632
// (C1 == 0 && C2 == 1 && C3 == 1 && C4 == 1), 0.132
// (C1 == 0 && C2 == 1 && C3 == 1 && C4 == 0), 0.108
// (C1 == 0 && C2 == 1 && C3 == 0 && C4 == 1), 0.124
// (C1 == 0 && C2 == 1 && C3 == 0 && C4 == 0), 0.124
// (C1 == 0 && C2 == 0 && C3 == 1 && C4 == 1), 0.124
// (C1 == 0 && C2 == 0 && C3 == 1 && C4 == 0), 0.128
// (C1 == 0 && C2 == 0 && C3 == 0 && C4 == 1), 0.132
// (C1 == 0 && C2 == 0 && C3 == 0 && C4 == 0), 0.128

// conditional expressions for PASSING TRACES, following by time in secs. + means it generated a passing trace.
// (C1 == 1 && C2 == 1 && C3 == 1 && C4 == 1), 0.692 +
// (C1 == 1 && C2 == 1 && C3 == 1 && C4 == 0), 0.728 +
// (C1 == 1 && C2 == 1 && C3 == 0 && C4 == 1), 0.660
// (C1 == 1 && C2 == 1 && C3 == 0 && C4 == 0), 0.692 +
// (C1 == 1 && C2 == 0 && C3 == 1 && C4 == 1), 0.408
// (C1 == 1 && C2 == 0 && C3 == 1 && C4 == 0), 0.380
// (C1 == 1 && C2 == 0 && C3 == 0 && C4 == 1), 0.408
// (C1 == 1 && C2 == 0 && C3 == 0 && C4 == 0), 0.628
// (C1 == 0 && C2 == 1 && C3 == 1 && C4 == 1), 0.120
// (C1 == 0 && C2 == 1 && C3 == 1 && C4 == 0), 0.136
// (C1 == 0 && C2 == 1 && C3 == 0 && C4 == 1), 0.128
// (C1 == 0 && C2 == 1 && C3 == 0 && C4 == 0), 0.128
// (C1 == 0 && C2 == 0 && C3 == 1 && C4 == 1), 0.128
// (C1 == 0 && C2 == 0 && C3 == 1 && C4 == 0), 0.128
// (C1 == 0 && C2 == 0 && C3 == 0 && C4 == 1), 0.116
// (C1 == 0 && C2 == 0 && C3 == 0 && C4 == 0), 0.112

// MATRIX
// 1 1 1 1 -
// 1 1 1 1 +
// 1 1 1 0 +
// 1 1 0 0 +
//
// TRIMMED:
// 1 1 1 -
// 1 1 1 +
// 1 1 0 +
// 1 0 0 +
// BRUTE FORCE TIME = 11.424

// FCBMC

// MATRIX - Note this is the same matrix as the one done above except the columns are swapped for implementation reasons. This confirms that the matrix produced by the brute force algorithm is equivalent to the FCBMC implementation.

// 1 1 1 -
// 1 0 1 +
// 0 0 1 +
// 1 1 1 +

// FCBMC TIME = 15.040s!
#include <assert.h>

void __VERIFIER_assert(int cond) {
if (!(cond)) {
assert(0);
}
return;
}
unsigned int __VERIFIER_nondet_uint();
int main() {

int C1 = 0;
int C2 = 0;
int C3 = 0;
int C4 = 0;

unsigned int SIZE=__VERIFIER_nondet_uint();
int i, j, k, key;
int v[SIZE];

C1 = 1;

for (j=1;j<SIZE;j++) {

  C2 = 1;

  key = v[j];
  i = j - 1;
  while((i>=0) && (v[i]>key)) {

     C3 = 1;

     if (i<2) // BUG: should be eliminated line 17
{
     C4 = 1;

     v[i+1] = v[i];
}

     i = i - 1;
  }
  v[i+1] = key;	        

}

for (k=1;k<SIZE;k++)
{
if (1) // assertion condition
{
__VERIFIER_assert(v[k-1]<=v[k]);
}
}

return 0;
}

from cbmc.

theyoucheng avatar theyoucheng commented on August 16, 2024

from cbmc.

theyoucheng avatar theyoucheng commented on August 16, 2024

from cbmc.

Related Issues (6)

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.