I want to verify a formula of the form:
Exists p . ForAll x != 0 . f(x, p) > 0 and g(x, p) < 0
All variables are reals.
As suggested here, I add this list to the solver:
[ForAll([x0, x1],
Implies(Or(x0 != 0, x1 != 0),
And(P0*x0*x0 + P1*x0*x1 + P2*x0*x1 + P3*x1*x1 > 0,
-2*P0*x0*x1 + P1*x0*x0 - P1*x0*x1 - P1*x1*x1 + P2*x0*x0 - P2*x0*x1 - P2*x1*x1 + 2*P3*x0*x1 - 2*P3*x1*x1 < 0
)
)
)
]
The solver with the above formula returns unsat
. A possible solution is for P
to be [[1.5, -0.5], [-0.5, 1]]
and in fact, by substituting those values, the formula is satisfied:
And(3/2*x0*x0 - 1*x0*x1 + x1*x1 > 0,
-1*x0*x0 - 1*x1*x1 < 0)
Is there a way to actually compute such a p
? If it's hard for z3, is there any alternative for this problem?