I have installed frama-c using opam and homebrew, following the instructions from the frama-c site. I'm on Mac OS X (El Capitan), and the versions are:
frama-c: Magnesium-20151002
alt-ergo: 1.01
ocaml: 4.02.3
When I attempt to run with the swap.c tutorial, it fails to verify. Here's the error I get:
[ frama-c ]> frama-c -wp -wp-out temp swap.c swap1.h
[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] Parsing swap.c (with preprocessing)
[kernel] Parsing swap1.h (with preprocessing)
[wp] warning: Missing RTE guards
[wp] 2 goals scheduled
------------------------------------------------------------
--- Alt-Ergo (stdout) :
------------------------------------------------------------
File "temp/typed/swap_post_A_Alt-Ergo.mlw", line 786, characters 1-299:Valid (0.0093) (12 steps)
------------------------------------------------------------
[wp] [Alt-Ergo] Goal typed_swap_post_A : Failed
Error: Can not understand Alt-Ergo output.
[wp] Proved goals: 1 / 2
Qed: 1
Alt-Ergo: 0 (failed: 1)
The output message seems to suggest that alt-ergo could prove the assertion, but then frama-c could not parse the output. Could this be because the alt-ergo version is too new? Here is the goal on line 786 of the generated file, referenced in the above output:
goal swap_post_A:
forall t : (addr,int) farray.
forall a_1,a : addr.
let x = t[a] : int in
let x_1 = t[a_1] : int in
let x_2 = t[a_1 <- x][a <- x_1][a_1] : int in
is_sint32(x) ->
is_sint32(x_1) ->
(region(a.base) <= 0) ->
(region(a_1.base) <= 0) ->
is_sint32(x_2) ->
(x = x_2)
If I run alt-ergo on this generated file directly, it returns with code 0.
Related
I have this simple routine where I want to remove some dirs from $PATH:
test.py
import os
import shutil
# remove babel from PATH
bins = ["babel", "obabel"]
env_path = os.environ["PATH"].split(":")[:]
for abin in bins:
bpath = shutil.which(abin)
try:
rr = os.path.dirname(bpath) # <- mypy error
except TypeError:
rr = None
try:
env_path.remove(rr) # <- mypy error
except ValueError:
pass
os.environ["PATH"] = ":".join(env_path)
This does work, however mypy complains:
mypy --ignore-missing-imports test.py
test.py:10: error: Value of type variable "AnyStr" of "dirname" cannot be "Optional[str]"
test.py:14: error: Argument 1 to "remove" of "list" has incompatible type "Optional[str]"; expected "str"
Found 2 errors in 1 file (checked 1 source file)
I understand that bpath can be a str or None (hence the try), so I tried bpath: Optional[str] but that gave me others mypy errors.
Anyway, how to bring peace to mypy here?
Apparently, based on the suggestions from the comments, this seems to have worked:
for abin in bins:
bpath = shutil.which(abin)
if bpath:
rr = os.path.dirname(bpath)
else:
rr = ""
try:
env_path.remove(rr)
except ValueError:
pass
No complains from mypy.
I'm trying to install addmtoolbox on Rstudio. every things is fine but at last i got this error:
Error: Vignette re-building failed.
Execution halted
Error: Failed to install 'addmtoolbox' from GitHub:
System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr (last 10 lines):
E> Quitting from lines 80-84 (addmtoolbox_modelfit_walkthrough.Rmd)
E> Error: processing vignette 'addmtoolbox_modelfit_walkthrough.Rmd' failed with diagnostics:
E> x is not a data.table
E> --- failed re-building 'addmtoolbox_modelfit_walkthrough.Rmd'
E>
E> SUMMARY: processing the following file failed:
E> 'addmtoolbox_modelfit_walkthrough.Rmd'
E>
E> Error: Vignette re-building failed.
E> Execution halted
also i'm trying to install package from zip file. installation is successful but when i run addm_preprocess function,
i got same error:
> my.dat = addm_preprocess(choice.dat = addm_data_choice,
+ eye.dat = addm_data_eye,
+ timestep = 10,
+ rtbinsize = 100)
Error in setkeyv(x, cols, verbose = verbose, physical = physical) :
x is not a data.table
would you please help me?
thanks.
addmtoolbox:
https://rdrr.io/github/AlexanderFengler/addmtoolbox/
EDIT:
i found error code:
eye$fixdur = timestep * round(eye$fixdur/timestep)
rts = eye %>% group_by(id) %>% summarize(rt = sum(fixdur))
setkey(rts,id)
choice = choice %>% select(-rt)
choice = choice[rts]
setkey(rts,id) return error:
> rts
# A tibble: 1 x 2
id rt
* <dbl> <dbl>
1 0 0
> setkey(rts,id)
Error in setkeyv(x, cols, verbose = verbose, physical = physical) :
x is not a data.table
solution by : hdkrgr
It looks like you're providing a tibble when a data.table is expected.
You should be able to convert the object with as.data.table.
Alternatively you could also use dtyplyr for unified tibble/data.table
objects. github.com/tidyverse/dtplyr
i have the problem with the following code with the error
=' not supported between instances of 'int' and 'NoneType'
b = None
if max([a, b]) <= t:
I want the code to work in both python 2 and python 3. The above code is working in python 2 because comparison is allowed between NoneType and INT but not allowed in python3,
if max([simil_bank, simil_efx]) <= Tl:
You could provide a key function that returns -inf when the value is None:
if max([a, b], key=lambda val: float('-inf') if val is None else val) <= t:
With a sample find.c file, I can prove it with no problem using default alt-ergo. But when change to cvc4 then getting warning messages and syntax error. Here the code:
/*# requires 0 <= n && \valid(a+(0..n-1));
assigns \nothing;
ensures (\result == -1 && ! (\exists int i; 0<=i<n && a[i] == v))
|| (0 <= \result < n && a[\result] == v);
*/
int find(int n,const int a[n],int v)
{
int i;
/*# loop invariant 0<=i<=n;
loop invariant \forall int j; 0<=j<i ==> a[j] != v;
loop assigns i;
loop variant n - i;
*/
for (i=0; i<n; ++i)
if (a[i] == v)
return i;
return -1;
}
int main(void)
{
const int const a1[5] = { 9,7,8,9,6 };
int const f1 = find(5,a1,8);
return 0;
}
Run this command and get these messages:
frama-c -wp -wp-prover CVC4 -wp-out out find.c
File "out/typed/find_Why3_ide.why", line 14, characters 0-20:
warning: the keyword `import' is redundant here and can be omitted
File "out/typed/find_Why3_ide.why", line 15, characters 0-28:
warning: the keyword `import' is redundant here and can be omitted
File "out/typed/Compound.why", line 6, characters 0-20:
warning: the keyword `import' is redundant here and can be omitted
File "out/typed/Compound.why", line 7, characters 0-18:
warning: the keyword `import' is redundant here and can be omitted
File "out/typed/Compound.why", line 8, characters 0-31:
warning: the keyword `import' is redundant here and can be omitted
File "out/typed/Compound.why", line 9, characters 0-25:
warning: the keyword `import' is redundant here and can be omitted
File "out/typed/Compound.why", line 10, characters 0-18:
warning: the keyword `import' is redundant here and can be omitted
File "out/typed/Compound.why", line 12, characters 0-18:
warning: the keyword `import' is redundant here and can be omitted
File "out/typed/Compound.why", line 13, characters 0-24:
warning: the keyword `import' is redundant here and can be omitted
File "out/typed/find_Why3_ide.why", line 17, characters 60-61:
syntax error
------------------------------------------------------------
[wp] [CVC4] Goal typed_find_loop_inv_2_preserved : Failed
Why3 exits with status 1.
[wp] [CVC4] Goal typed_find_loop_inv_preserved : Failed
Why3 exits with status 1.
[wp] [CVC4] Goal typed_find_post : Failed
Why3 exits with status 1.
[wp] Proved goals: 10 / 13
Qed: 10 (4ms)
CVC4: 0 (failed: 3)
How to get rid of the warnings and syntax error? My CVC4 is version 1.6.
I get a bounds error when running a function in parallel that runs fine normally (sequentially) e.g. when I run:
parallelsol = #time pmap(i -> findividual(x,y,z), 1:50)
It gives me an error:
exception on 2: exception on exception on 16: 20exception on 5: : ERROR: BoundsError()
in getindex at array.jl:246 (repeats 2 times)
But when I run:
parallelsol = #time map(i -> findividual(prodexcint,firstrun,q,r,unempinc,VUnempperm,Indunempperm,i,VUnemp,poachedwagevec, mw,k,Vp,Vnp,reswage), 1:50)
It runs fine. Any ideas as to why this might be happening?