smt - How to display specific unsat constraint, not whole core (Z3, Python) -
how can list specific constraint result unsat core? have lot of conditions , printing whole core doesn't print all. read can done assert_and_track , unsat_core commands. found examples don't works. experience this?
s.assert_and_track(a > b, 'p1') s.assert_and_track(b > c, 'p2') if s.check() == sat: print('ok') else: c = s.unsat_core print(c) <- print core
so how print p1 or p2 (just true/false result) ? e.g. p2 = false, or can displayed in way displayed in print(c) mode - p1.
the easiest way achieve save map of labels constraints, examples can
m = {} m['p1'] = (a > b) m['p2'] = (b > c) m['p3'] = (c > a)
so later can print core in terms of constraints, instance follows
core = s.unsat_core() e in core: print(m[str(e)])
of course work if want print entries instead of of them.
Comments
Post a Comment