2016-11-07 16:16:55 +00:00
|
|
|
# Copyright (c) Microsoft Corporation 2015, 2016
|
|
|
|
|
|
|
|
|
|
# The Z3 Python API requires libz3.dll/.so/.dylib in the
|
|
|
|
|
# PATH/LD_LIBRARY_PATH/DYLD_LIBRARY_PATH
|
2019-01-18 16:18:16 -08:00
|
|
|
# environment variable and the PYTHONPATH environment variable
|
2016-11-07 16:16:55 +00:00
|
|
|
# needs to point to the `python' directory that contains `z3/z3.py'
|
|
|
|
|
# (which is at bin/python in our binary releases).
|
|
|
|
|
|
|
|
|
|
# If you obtained example.py as part of our binary release zip files,
|
|
|
|
|
# which you unzipped into a directory called `MYZ3', then follow these
|
|
|
|
|
# instructions to run the example:
|
|
|
|
|
|
|
|
|
|
# Running this example on Windows:
|
|
|
|
|
# set PATH=%PATH%;MYZ3\bin
|
|
|
|
|
# set PYTHONPATH=MYZ3\bin\python
|
|
|
|
|
# python example.py
|
|
|
|
|
|
|
|
|
|
# Running this example on Linux:
|
|
|
|
|
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:MYZ3/bin
|
|
|
|
|
# export PYTHONPATH=MYZ3/bin/python
|
|
|
|
|
# python example.py
|
|
|
|
|
|
2018-10-02 17:38:09 +07:00
|
|
|
# Running this example on macOS:
|
2016-11-07 16:16:55 +00:00
|
|
|
# export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:MYZ3/bin
|
|
|
|
|
# export PYTHONPATH=MYZ3/bin/python
|
|
|
|
|
# python example.py
|
|
|
|
|
|
2015-06-10 12:01:47 -07:00
|
|
|
|
2012-10-02 08:24:25 -07:00
|
|
|
from z3 import *
|
|
|
|
|
|
|
|
|
|
x = Real('x')
|
|
|
|
|
y = Real('y')
|
|
|
|
|
s = Solver()
|
|
|
|
|
s.add(x + y > 5, x > 1, y > 1)
|
2012-12-20 17:47:38 -08:00
|
|
|
print(s.check())
|
|
|
|
|
print(s.model())
|