I am new to Z3py. I am trying to list all satisfied solutions to a bool formula (or to get the truth table which generate only True).
My code is here, inspired from another answer finding all satisfying models:
from z3 import *
A1, B1, B2, C1, C2, E1, E2, F4 = Bools('A1 B1 B2 C1 C2 E1 E2 F4')
s = Solver()
s.add(simplify(Or(And(A1, Or(C1, C2), Or(B1, B2), E2, F4),
And(A1, C2, Or(B1, B2), E1))))
while s.check() == sat:
print(s.model())
s.add(Or(A1 != s.model()[A1],
B1 != s.model()[B1],
B2 != s.model()[B2],
C1 != s.model()[C1],
C2 != s.model()[C2],
E1 != s.model()[E1],
E2 != s.model()[E2],
F4 != s.model()[F4]))
but I got results like this:
True,True,None,None,True,True,False,None
True,True,None,None,True,True,False,None
True,True,None,None,True,True,False,None
True,True,None,None,True,True,False,None
...
as you can see, they have duplicated results, and there are "None" in it, why is this happening? Isn't it true that Bool variable has only "true" or "false"? Why there are duplicated models in it? Thank you very much.