Skip to content
Snippets Groups Projects
Commit 3196fa0b authored by chsieh16's avatar chsieh16
Browse files

Output smtlib for Z3

parent bceee292
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,7 @@ def synth_dtree(learner: LearnerBase, teacher: TeacherBase, num_max_iterations: ...@@ -43,7 +43,7 @@ def synth_dtree(learner: LearnerBase, teacher: TeacherBase, num_max_iterations:
continue continue
elif result == z3.unsat: elif result == z3.unsat:
print("we are done!") print("we are done!")
return True, (k, z3.simplify(candidate, arith_lhs=True).sexpr()) return True, (k, z3.simplify(candidate, arith_lhs=True))
else: else:
return False, f"Reason Unknown {teacher.reason_unknown()}" return False, f"Reason Unknown {teacher.reason_unknown()}"
...@@ -110,12 +110,15 @@ def synth_dtree_per_part( ...@@ -110,12 +110,15 @@ def synth_dtree_per_part(
num_max_iterations=num_max_iter) num_max_iterations=num_max_iter)
print(f"Found? {found}") print(f"Found? {found}")
if found: if found:
k, expr = ret k, z3_expr = ret
solver = z3.Solver()
solver.add(z3_expr)
smtlib = solver.to_smt2()
result.append({"part": part, result.append({"part": part,
"feature_domain": feature_domain, "feature_domain": feature_domain,
"ultimate_bound": ult_bound, "ultimate_bound": ult_bound,
"status": "found", "status": "found",
"result": {"k": k, "formula": expr}}) "result": {"k": k, "formula": z3_expr.sexpr(), "smtlib": smtlib}})
else: else:
result.append({"part": part, result.append({"part": part,
"feature_domain": feature_domain, "feature_domain": feature_domain,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment