Continuing on from my question about set representation, if you define a set as follows:
from z3 import *
s = Solver()
string_set = Function('string_set', StringSort(), BoolSort())
s.add(string_set(StringVal('foo')))
s.add(string_set(StringVal('bar')))
s.add(string_set(StringVal('baz')))
this doesn't really specify the set {foo, bar, baz}
because it says nothing about what values are not in the set; if asked to find a model, Z3 can easily come up with the function [else -> True]
which satisfies all these constraints.
What is the easiest way to specify that the function is true only for those specific values? The objective is to produce the model:
[
"foo" -> True,
"bar" -> True,
"baz" -> True,
else -> False
]
do I really have to quantify over all strings that are not in that explicit set?