0

I would like to kindly ask , how to have more than 255 arguments in the Z3 Python function

    h1, h2 = Consts('h1 h2', S)
     def fun(h1 , h2):
          return Or(
 And( h1 == cl_4712, h2 == me_1935),
 And( h1 == cl_1871, h2 == me_1935),
 And( h1 == cl_4712, h2 == me_1935),
                   .
                   .
                   .
  And( h1 == cl_1871, h2 == me_6745)
                )

1 Answers1

1
func(arg1, arg2, arg3)

is exactly equivalent to

args = (arg1, arg2, arg3)
func(*args)

So supply the arguments as a single iterable:

Or(*(And(...),...))

Or more clearly:

conditions = (And(...), ...)
Or(*conditions)

Or perhaps you can just supply a generator that produces your conditions:

def AndCond(a, b):
    for ....:
        yield And(...)

Or(*AndCond(v1, v2))

I would probably have written your code like this:

h1, h2 = Consts('h1 h2', S)
def fun(h1 , h2):
    # possibly this should be a set() or frozenset()
    # since logically every pair should be unique?
    h1_h2_and_conds = [
        (cl_4712, me_1935),
        (cl_1871, me_1935),
        (cl_1871, me_6745),
        # ...
    ]
    and_conds = (And(h1==a, h2==b) for a,b in h1_h2_and_conds)
    return Or(*and_conds)
Francis Avila
  • 31,233
  • 6
  • 58
  • 96