Expression sharing via (uninterpreted) functions #6296
Unanswered
ThomasHaas
asked this question in
Q&A
Replies: 1 comment 3 replies
-
You can define f as a recursive function. While z3 detects that f isn't recursive and has special unfolding for it, the unfolding semantics is delayed. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background: I have a BMC tool that finds bugs in C-code. One of its preprocessing steps is inlining of functions calls.
Now suppose there is a function
f(x) = some complex expression in x
and there are multiple calls to this function in the code, let's say,Inlining the function calls and then translating this code into SMT (+ some assertions of course) will cause the resulting formula to contain the complex expression 3 times (for r, s, and t), which I think may cause the solver to do redundant reasoning.
Now my question is this: If I introduce an uninterpreted function symbol
f
, add the assertionassert forall x: f(x) = complex expression in x
and then reuse this function symbol in the actual SMT-query, will this help the solver in some way or does it rather hurt the solver because of the newforall
quantifier? Will the solver perhaps just instantiate the definition off
3 times and essentially produce the identical query as the original one?Is there a maybe another trick to maximize sharing of expressions and minimize redundant reasoning for the solver?
Beta Was this translation helpful? Give feedback.
All reactions