z3.simplify() with bounds / assertions #7346
-
Hi, I'm writing a high-performance application. I have a few nifty techniques to save computing time, but I'm noticing that there are a few (very large) computations being thrown into the z3 solver. A lot of them are variations of Hence, are there methods to be able to perform these simplifications based on bounds/assertions? I have seen the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
One trick I've used for contextual simplification that I learned from @calebh is to put the assumptions into a Solver or Goal, create a fresh name to the simplified term in an equation, and run a couple tactics (demodulator, elim-predicates, simplify, other useful ones? https://microsoft.github.io/z3guide/docs/strategies/tactics/ ). https://github.com/philzook58/knuckledragger/blob/2f3c04fd11f10c29b91520ad7ae75c3d7efad5db/knuckledragger/utils.py#L9 . You can then root around in the result for the fresh name to get your simplified term. If there is a better way, and there may well be, I'd like to know it. |
Beta Was this translation helpful? Give feedback.
if you use the solve-eqs tactic, it will replace either x or i, and the bounds of either are combined.
So propagate-ineqs doesn't attempt to perform double duty of equality inference because this is handled by a different method (solve-eqs).