-
Hello, I find myself writing multiple Z3 If statements like this a lot in my code from z3 import *
a, b, c, d, e, f = Bools('a b c d e f')
formula = If(a, b, If(c, d, If(e, f, False))) Is there a better way to write this chain of If statements using the Z3 API? Thank you in advance for any advice provided. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
There isn't a "Cond" function from the API, but you can define your own. Maybe using infix hacking to define some convenient syntax such as a ==> b || c ==> d || e ==> f || False, depending on what python lets you overload. |
Beta Was this translation helpful? Give feedback.
-
Here's a quick ready-to-copy method:
|
Beta Was this translation helpful? Give feedback.
Here's a quick ready-to-copy method: