0

The ctx-solver-simplify tactic only works for bool variables, so how would I deal with variables over finite domain (e.g., which tactics to use)? For example, if z can only take 3 values 0,1,2, then how to simplify Or(z==0,z==1,z==2) to true ?

Also, even for bool expressions, the tactic ctx-solver-simplify doesn't simplify completely. For example:

x,y,z = z3.Bools('x y z')
c1 = z3.And(x==True,y==True,z==True)
c2 = z3.And(x==True,y==True,z==False)
c3 = z3.And(x==True,y==False,z==True)
c4 = z3.And(x==True,y==True,z==False)
z3.Tactic('ctx-solver-simplify')(z3.Or([c1,c2,c3,c4]))
[[Or(And(x, z), And(x == True, y == True, z == False))]]

How do I get something like And(x, Or(z, y)) ?

Thanks !

Vu Nguyen
  • 987
  • 1
  • 9
  • 20

1 Answers1

0

Reducing Boolean (or other finite-domain) problems to a minimal form is a hard problem. The ctx-solver-simplify tactic is one of the more expensive simplifiers, but it doesn't go all the way to the provably smallest form.

Problems from other domains (e.g., enumerations like z \in {0, 1, 2}) would have to be converted to Booleans first to use this tactic, but perhaps other tactics would be better suited, and perhaps a bit-vector encoding would help too.

Christoph Wintersteiger
  • 8,234
  • 1
  • 16
  • 30