I am trying to understand how related variables are indexed in z3. Here in the fragment in z3pyand the corresponding output. ( http://rise4fun.com/Z3Py/plVw1 )
x, y = Ints('x y')
f1 = ForAll(x, And(x == 0, Exists(y, x == y)))
f2 = ForAll(x, Exists(y, And(x == 0, x == y)))
print f1.body()
print f2.body()
Conclusion:
ν0 = 0 ∧ (∃y : ν1 = y)
y : ν1 = 0 ∧ ν1 = y
Q f1, why does the same related variable xhave a different index. ( 0and 1). If I modify f1and display Exists, it xhas the same index ( 0).
Reason I want to understand the indexing mechanism:
I have a FOL formula presented in DSL in scala that I want to send to z3. Now ScalaZ3has mkBoundapi to create related variables that take index, and sortas arguments. I am not sure what value should be passed to the argument index. So, I would like to know the following:
If I have two formulas phi1and phi2with the highest indices of variable bindings n1and n2what the index will be xinForAll(x, And(phi1, phi2))
Also, is there a way to show all variables in indexed form? f1.body()just shows me xin indexed form, not y. (I think the reason is ystill tied in f1.body())
source
share