Replies: 1 comment
-
Probably easiest to simply use Lines 8829 to 8852 in 5a9b0dd You can also use a python reduce expression to achieve the same, if you're willing to always put the arguments in a list: $ python
Python 3.9.9 (main, Nov 21 2021, 03:23:44)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from z3 import *
>>> import functools
>>> x, y = Ints('x y')
>>> s = Solver()
>>> s.add(functools.reduce(lambda a, b: a*b, [x, y, x, x], 1) == x)
>>> print(s.sexpr()) This prints:
And, tangentially, the stack-overflow forum https://stackoverflow.com/questions/tagged/z3py and https://stackoverflow.com/questions/tagged/z3 are more suitable for these sorts of questions. |
Beta Was this translation helpful? Give feedback.
0 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.
-
If I wanted to add the assertion
(assert (= (* a a) b))
via the python API I would write something like this:s = z3.Solver() s.add(a * a == b)
Now, consider the following assertion:
(assert (= (* a a a) b))
or(assert (= (* a) b))
. How would I add them in the Python API?Beta Was this translation helpful? Give feedback.
All reactions