#!/usr/bin/env python
"""
Helper script to convert the log generated by '-debug-only=constraint-system'
to a Python script that uses Z3 to verify the decisions using Z3's Python API.
Example usage:
> cat path/to/file.log
---
x6 + -1 * x7 <= -1
x6 + -1 * x7 <= -2
sat
> ./convert-constraint-log-to-z3.py path/to/file.log > check.py && python ./check.py
> cat check.py
from z3 import *
x3 = Int("x3")
x1 = Int("x1")
x2 = Int("x2")
s = Solver()
s.add(x1 + -1 * x2 <= 0)
s.add(x2 + -1 * x3 <= 0)
s.add(-1 * x1 + x3 <= -1)
assert(s.check() == unsat)
print('all checks passed')
"""
=
=
=
=
=
=
=
=
continue
=