The below program returns unsat when ran on z3.
(assert ( forall ( (y (Array Int Int)) )
(= (select y 1) 0)
))
(check-sat)
I don't get, what does the line "forall" actually mean; Does it mean, for all arrays - Int y [Int], is there a possibility of y[1] == 0 ? If yes, then SAT, else UNSAT ? Why is z3 returning unsat, when I run the above code ?
Here's the C code that I wrote for Seahorn, corresponding to the above smt2 file.
#include "seahorn/seahorn.h"
extern int nd();
int main(void){
int n = nd();
assume(n>0);
int y[n];
for(int i = 0; i < n; i++)
{
sassert(y[1]=0);
}
}
I converted the C code to smt2 file using Seahorn and then formatted it using format.py, from CHC Comp 2020, and then ran z3 on the formatted file which gives - unsat.
Although, the answer of both the files is same, I don't think, this is correct code. The original smt2 file says "Forall array y", whereas, my c code says, "for all elements in an array y". How do I write the correct c code for this problem?
[Please note: I referred z3's tutorial, but still, am not clear]