PySMT 0.9.7.dev120__tar.gz → 0.9.7.dev132__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {PySMT-0.9.7.dev120/PySMT.egg-info → PySMT-0.9.7.dev132}/PKG-INFO +1 -1
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132/PySMT.egg-info}/PKG-INFO +1 -1
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/__init__.py +1 -1
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/installers/btor.py +23 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/parsing.py +21 -16
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/rewritings.py +1 -1
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/shortcuts.py +25 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/btor.py +17 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_cnf.py +6 -1
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_formula.py +33 -1
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_hr_parsing.py +10 -1
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/LICENSE +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/MANIFEST.in +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/NOTICE +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/PySMT.egg-info/SOURCES.txt +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/PySMT.egg-info/dependency_links.txt +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/PySMT.egg-info/entry_points.txt +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/PySMT.egg-info/top_level.txt +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/README.rst +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/docs/CHANGES.rst +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/docs/api_ref.rst +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/docs/development.rst +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/docs/getting_started.rst +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/docs/index.rst +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/docs/tutorials/boolean_logic.rst +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/docs/tutorials.rst +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/__main__.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/__init__.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/check_version.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/install.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/installers/__init__.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/installers/base.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/installers/bdd.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/installers/cvcfive.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/installers/cvcfour.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/installers/msat.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/installers/pico.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/installers/yices.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/installers/z3.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/cmd/shell.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/configuration.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/constants.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/decorators.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/environment.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/exceptions.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/factory.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/fnode.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/formula.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/logics.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/operators.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/oracles.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/printers.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/simplifier.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/smtlib/__init__.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/smtlib/annotations.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/smtlib/commands.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/smtlib/parser/__init__.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/smtlib/parser/parser.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/smtlib/printers.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/smtlib/script.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/smtlib/solver.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/smtlib/utils.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/__init__.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/bdd.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/cvcfive.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/cvcfour.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/eager.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/interpolation.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/msat.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/options.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/pico.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/portfolio.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/qelim.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/smtlib.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/solver.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/yices.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/solvers/z3.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/substituter.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/__init__.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/configs/config1.ini +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/configs/config_bad.ini +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/examples.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/__init__.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/parser_utils.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_annotations.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_fuzzed.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_generic_wrapper.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_griggio.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_model_validation.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_parser_examples.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_parser_extensibility.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_parser_lra.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_parser_qf_arrays.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_parser_qf_lia.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_parser_qf_lira.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_parser_qf_lra.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_parser_qf_nia.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_parser_qf_nra.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_parser_qf_uf.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_parser_qf_ufbv.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_parser_type_error.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/smtlib/test_smtlibscript.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_array.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_back.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_bdd.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_bv.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_bv_simplification.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_configuration.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_constants.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_cvc_quantifiers.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_dwf.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_eager_model.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_env.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_euf.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_imports.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_int.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_interpolation.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_lira.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_logics.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_models.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_native_qe.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_nia.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_nlira.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_oracles.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_portfolio.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_printing.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_qe.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_regressions.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_rewritings.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_shannon_expansion.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_simplify.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_size.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_solving.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_sorts.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_string.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_typechecker.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_unsat_cores.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_walker_ext.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/test/test_walkers.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/type_checker.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/typing.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/utils.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/walkers/__init__.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/walkers/dag.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/walkers/generic.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/walkers/identitydag.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/pysmt/walkers/tree.py +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/setup.cfg +0 -0
- {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev132}/setup.py +0 -0
|
@@ -12,9 +12,24 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
import os
|
|
15
|
+
from tempfile import NamedTemporaryFile
|
|
15
16
|
|
|
16
17
|
from pysmt.cmd.installers.base import SolverInstaller
|
|
17
18
|
|
|
19
|
+
CYTHON_PATCH = '''\
|
|
20
|
+
--- pyboolector.pyx 2025-05-12 14:01:27.528128358 +0200
|
|
21
|
+
+++ pyboolector.pyx.patched 2025-05-12 14:07:26.685645023 +0200
|
|
22
|
+
@@ -1274,7 +1274,7 @@
|
|
23
|
+
Parameter ``width`` is only required if ``c`` is an integer.
|
|
24
|
+
"""
|
|
25
|
+
cdef BoolectorConstNode r
|
|
26
|
+
- if isinstance(c, int) or (sys.version < '3' and isinstance(c, long)):
|
|
27
|
+
+ if isinstance(c, int):
|
|
28
|
+
if c != 0 and c.bit_length() > width:
|
|
29
|
+
raise BoolectorException(
|
|
30
|
+
"Value of constant {} (bit width {}) exceeds bit "\\
|
|
31
|
+
'''
|
|
32
|
+
|
|
18
33
|
|
|
19
34
|
class BtorInstaller(SolverInstaller):
|
|
20
35
|
|
|
@@ -59,6 +74,14 @@ class BtorInstaller(SolverInstaller):
|
|
|
59
74
|
SolverInstaller.untar(os.path.join(self.base_dir, self.archive_name),
|
|
60
75
|
self.extract_path)
|
|
61
76
|
|
|
77
|
+
# Patching for cython 3.8
|
|
78
|
+
with NamedTemporaryFile() as f:
|
|
79
|
+
f.write(CYTHON_PATCH.encode())
|
|
80
|
+
f.flush()
|
|
81
|
+
f.seek(0)
|
|
82
|
+
SolverInstaller.run("patch src/api/python/pyboolector.pyx -i %s" % f.name,
|
|
83
|
+
directory=self.extract_path)
|
|
84
|
+
|
|
62
85
|
# Build lingeling
|
|
63
86
|
SolverInstaller.run("bash ./contrib/setup-lingeling.sh",
|
|
64
87
|
directory=self.extract_path)
|
|
@@ -126,9 +126,6 @@ class HRLexer(Lexer):
|
|
|
126
126
|
Rule(r"\"(.*?)\"", self.string_constant, True), # String Constant
|
|
127
127
|
Rule(r"BV\{(\d+)\}", self.bv_type, True),# BV Type
|
|
128
128
|
Rule(r"(Array\{)", OpenArrayTypeTok(), False),# Array Type
|
|
129
|
-
Rule(r"(Int)", IntTypeTok(), False),# Int Type
|
|
130
|
-
Rule(r"(Real)", RealTypeTok(), False),# Real Type
|
|
131
|
-
Rule(r"(Bool)", BoolTypeTok(), False),# Bool Type
|
|
132
129
|
Rule(r"(&)", InfixOpAdapter(self.AndOrBVAnd, 40), False),# conjunction
|
|
133
130
|
Rule(r"(\|)", InfixOpAdapter(self.OrOrBVOr, 30), False),# disjunction
|
|
134
131
|
Rule(r"(!)", UnaryOpAdapter(self.NotOrBVNot, 50), False),# negation
|
|
@@ -168,19 +165,10 @@ class HRLexer(Lexer):
|
|
|
168
165
|
Rule(r"(:=)", ArrStore(), False),# ArrStore
|
|
169
166
|
Rule(r"(::)", InfixOpAdapter(self.mgr.BVConcat, 90), False),# BVXor
|
|
170
167
|
Rule(r"(:)", ExprElse(), False),# colon
|
|
171
|
-
Rule(r"(False)", Constant(self.mgr.FALSE()), False), # False
|
|
172
|
-
Rule(r"(True)", Constant(self.mgr.TRUE()), False),# True
|
|
173
168
|
Rule(r"(,)", ExprComma(), False),# comma
|
|
174
169
|
Rule(r"(\.)", ExprDot(), False),# dot
|
|
175
|
-
Rule(r"(
|
|
176
|
-
Rule(r"(
|
|
177
|
-
Rule(r"(ROL)", InfixOpAdapter(self.BVHack(self.mgr.BVRol), 90), False),# BVRol
|
|
178
|
-
Rule(r"(ZEXT)", InfixOpAdapter(self.BVHack(self.mgr.BVZExt), 90), False),# BVZext
|
|
179
|
-
Rule(r"(SEXT)", InfixOpAdapter(self.BVHack(self.mgr.BVSExt), 90), False),# BVSext
|
|
180
|
-
Rule(r"(bvcomp)", InfixOpAdapter(self.mgr.BVComp, 90), False),#
|
|
181
|
-
Rule(r"(forall)", Quantifier(self.mgr.ForAll, 20), False),#
|
|
182
|
-
Rule(r"(exists)", Quantifier(self.mgr.Exists, 20), False),#
|
|
183
|
-
Rule(r"(ToReal)", UnaryOpAdapter(self.mgr.ToReal, 100), False),#
|
|
170
|
+
Rule(r"(forall\s+)", Quantifier(self.mgr.ForAll, 20), False),#
|
|
171
|
+
Rule(r"(exists\s+)", Quantifier(self.mgr.Exists, 20), False),#
|
|
184
172
|
Rule(r"(str\.len)", FunctionCallAdapter(self.mgr.StrLength, 100), False), # str_length
|
|
185
173
|
Rule(r"(str\.\+\+)", FunctionCallAdapter(self.mgr.StrConcat, 100), False), # str_concat
|
|
186
174
|
Rule(r"(str\.at)", FunctionCallAdapter(self.mgr.StrCharAt, 100), False), # str_charat
|
|
@@ -192,14 +180,28 @@ class HRLexer(Lexer):
|
|
|
192
180
|
Rule(r"(str\.suffixof)", FunctionCallAdapter(self.mgr.StrSuffixOf, 100), False), # str_suffixof
|
|
193
181
|
Rule(r"(str\.to\.int)", FunctionCallAdapter(self.mgr.StrToInt, 100), False), # str_to_int
|
|
194
182
|
Rule(r"(int\.to\.str)", FunctionCallAdapter(self.mgr.IntToStr, 100), False), # int_to_str
|
|
195
|
-
Rule(r"(bv2nat)", UnaryOpAdapter(self.mgr.BVToNatural, 100), False),#
|
|
196
183
|
Rule(r"'(.*?)'", self.identifier, True), # quoted identifiers
|
|
197
184
|
Rule(r"([A-Za-z_][A-Za-z0-9_]*)", self.identifier, True),# identifiers
|
|
198
185
|
Rule(r"(.)", self.lexing_error, True), # input error
|
|
199
186
|
]
|
|
200
|
-
|
|
201
187
|
self.rules += hr_rules
|
|
202
188
|
|
|
189
|
+
self._identifier_map = {
|
|
190
|
+
"False": Constant(self.mgr.FALSE()), # False
|
|
191
|
+
"True": Constant(self.mgr.TRUE()),# True
|
|
192
|
+
"xor": InfixOpAdapter(self.mgr.BVXor, 10),# BVXor
|
|
193
|
+
"bv2nat": UnaryOpAdapter(self.mgr.BVToNatural, 100),#
|
|
194
|
+
"bvcomp": InfixOpAdapter(self.mgr.BVComp, 90),#
|
|
195
|
+
"ROR": InfixOpAdapter(self.BVHack(self.mgr.BVRor), 90),# BVRor
|
|
196
|
+
"ROL": InfixOpAdapter(self.BVHack(self.mgr.BVRol), 90),# BVRol
|
|
197
|
+
"ZEXT": InfixOpAdapter(self.BVHack(self.mgr.BVZExt), 90),# BVZext
|
|
198
|
+
"SEXT": InfixOpAdapter(self.BVHack(self.mgr.BVSExt), 90),# BVSext
|
|
199
|
+
"ToReal": UnaryOpAdapter(self.mgr.ToReal, 100),#
|
|
200
|
+
"Int": IntTypeTok(),# Int Type
|
|
201
|
+
"Real": RealTypeTok(),# Real Type
|
|
202
|
+
"Bool": BoolTypeTok(),# Bool Type
|
|
203
|
+
}
|
|
204
|
+
|
|
203
205
|
self.compile()
|
|
204
206
|
|
|
205
207
|
def bv_type(self, read):
|
|
@@ -219,6 +221,9 @@ class HRLexer(Lexer):
|
|
|
219
221
|
return Constant(self.mgr.String(read))
|
|
220
222
|
|
|
221
223
|
def identifier(self, read):
|
|
224
|
+
res = self._identifier_map.get(read, None)
|
|
225
|
+
if res is not None:
|
|
226
|
+
return res
|
|
222
227
|
return Identifier(read, env=self.env)
|
|
223
228
|
|
|
224
229
|
def UMinusOrBvNeg(self, x):
|
|
@@ -162,7 +162,7 @@ class CNFizer(DagWalker):
|
|
|
162
162
|
return CNFizer.THEORY_PLACEHOLDER
|
|
163
163
|
|
|
164
164
|
def walk_function(self, formula, **kwargs):
|
|
165
|
-
ty = formula.
|
|
165
|
+
ty = formula.function_name().symbol_type()
|
|
166
166
|
if ty.return_type.is_bool_type():
|
|
167
167
|
return formula, CNFizer.TRUE_CNF
|
|
168
168
|
else:
|
|
@@ -233,6 +233,31 @@ def Ite(iff, left, right):
|
|
|
233
233
|
return get_env().formula_manager.Ite(iff, left, right)
|
|
234
234
|
|
|
235
235
|
|
|
236
|
+
def Abs(formula):
|
|
237
|
+
r"""Returns the absolute value of the formula.
|
|
238
|
+
|
|
239
|
+
This is implemented as If(formula > 0, formula, -formula).
|
|
240
|
+
Works for both integer and real values.
|
|
241
|
+
|
|
242
|
+
:param formula: The formula to compute the absolute value of
|
|
243
|
+
:returns: The absolute value of the formula
|
|
244
|
+
:raises: ValueError if the formula type is not integer or real
|
|
245
|
+
"""
|
|
246
|
+
# Get the type of the formula to determine the appropriate zero value
|
|
247
|
+
formula_type = get_type(formula)
|
|
248
|
+
|
|
249
|
+
# Create a zero value of the same type as the formula
|
|
250
|
+
if formula_type == types.INT:
|
|
251
|
+
zero = Int(0)
|
|
252
|
+
elif formula_type == types.REAL:
|
|
253
|
+
zero = Real(0)
|
|
254
|
+
else:
|
|
255
|
+
# Raise an error for unsupported types
|
|
256
|
+
raise ValueError(f"Abs function only supports integer and real types, got {formula_type}")
|
|
257
|
+
|
|
258
|
+
return Ite(GT(formula, zero), formula, Minus(zero, formula))
|
|
259
|
+
|
|
260
|
+
|
|
236
261
|
def Symbol(name, typename=types.BOOL):
|
|
237
262
|
"""Returns a symbol with the given name and type.
|
|
238
263
|
|
|
@@ -15,12 +15,29 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
#
|
|
18
|
+
from enum import Enum
|
|
19
|
+
import inspect
|
|
18
20
|
from math import log, ceil
|
|
19
21
|
|
|
20
22
|
from pysmt.exceptions import SolverAPINotFound
|
|
21
23
|
|
|
22
24
|
try:
|
|
23
25
|
import pyboolector
|
|
26
|
+
|
|
27
|
+
# Fixing interface for cython 3.1+
|
|
28
|
+
#
|
|
29
|
+
# Cython 3.1 changed the way enums are handled: the enum values are no
|
|
30
|
+
# longer added to the global namespace, while the documentation of btor
|
|
31
|
+
# relied on the old behavior of cython, Here, we first collect all the nums
|
|
32
|
+
# in the module and then we add their enumerands to the pyboolector module,
|
|
33
|
+
# making it work on either cython 3.0 or 3.1.
|
|
34
|
+
enums = []
|
|
35
|
+
for x in pyboolector.__dict__.values():
|
|
36
|
+
if inspect.isclass(x) and issubclass(x, Enum):
|
|
37
|
+
enums.append(x)
|
|
38
|
+
for x in enums:
|
|
39
|
+
pyboolector.__dict__.update(x.__members__)
|
|
40
|
+
|
|
24
41
|
except ImportError:
|
|
25
42
|
raise SolverAPINotFound
|
|
26
43
|
|
|
@@ -20,7 +20,7 @@ import pytest
|
|
|
20
20
|
|
|
21
21
|
from pysmt.shortcuts import Implies, is_sat, reset_env, Symbol, Iff
|
|
22
22
|
from pysmt.rewritings import CNFizer
|
|
23
|
-
from pysmt.logics import QF_BOOL, QF_LRA, QF_LIA, QF_UFLIRA
|
|
23
|
+
from pysmt.logics import QF_BOOL, QF_LRA, QF_LIA, QF_UFLIRA, QF_UFLRA
|
|
24
24
|
from pysmt.test import TestCase, skipIfNoSolverForLogic, main
|
|
25
25
|
from pysmt.test.examples import get_example_formulae
|
|
26
26
|
from pysmt.test.smtlib.parser_utils import SMTLIB_TEST_FILES, SMTLIB_DIR
|
|
@@ -53,6 +53,11 @@ class TestCnf(TestCase):
|
|
|
53
53
|
def test_examples_solving_lia(self):
|
|
54
54
|
self.do_examples(QF_LIA)
|
|
55
55
|
|
|
56
|
+
@skipIfNoSolverForLogic(QF_UFLRA)
|
|
57
|
+
def test_examples_solving_lia(self):
|
|
58
|
+
self.do_examples(QF_UFLRA)
|
|
59
|
+
|
|
60
|
+
@pytest.mark.slow
|
|
56
61
|
@skipIfNoSolverForLogic(QF_LIA)
|
|
57
62
|
def test_smtlib_cnf_small(self):
|
|
58
63
|
cnt = 0
|
|
@@ -19,7 +19,7 @@ import pysmt
|
|
|
19
19
|
|
|
20
20
|
from pysmt.typing import BOOL, REAL, INT, FunctionType, BV8, BVType
|
|
21
21
|
from pysmt.shortcuts import Symbol, is_sat, Not, Implies, GT, Plus, Int, Real
|
|
22
|
-
from pysmt.shortcuts import Minus, Times, Xor, And, Or, TRUE, Iff, FALSE, Ite
|
|
22
|
+
from pysmt.shortcuts import Minus, Times, Xor, And, Or, TRUE, Iff, FALSE, Ite, Abs
|
|
23
23
|
from pysmt.shortcuts import Equals
|
|
24
24
|
from pysmt.shortcuts import get_env
|
|
25
25
|
from pysmt.environment import Environment
|
|
@@ -317,6 +317,38 @@ class TestFormulaManager(TestCase):
|
|
|
317
317
|
inv = self.mgr.Real(Fraction(1) / self.rconst.constant_value())
|
|
318
318
|
self.assertEqual(n, self.mgr.Times(self.s, inv))
|
|
319
319
|
|
|
320
|
+
def test_abs_shortcut(self):
|
|
321
|
+
# Test with integer
|
|
322
|
+
abs_int = Abs(self.p)
|
|
323
|
+
|
|
324
|
+
# Verify the structure of the Abs node
|
|
325
|
+
self.assertTrue(abs_int.is_ite())
|
|
326
|
+
self.assertTrue(abs_int.arg(0).is_lt()) # GT is converted to LT with inverted args
|
|
327
|
+
self.assertEqual(abs_int.arg(0).arg(0), Int(0)) # First arg is 0
|
|
328
|
+
self.assertEqual(abs_int.arg(0).arg(1), self.p) # Second arg is p
|
|
329
|
+
self.assertEqual(abs_int.arg(1), self.p)
|
|
330
|
+
self.assertTrue(abs_int.arg(2).is_minus())
|
|
331
|
+
self.assertEqual(abs_int.arg(2).arg(0), Int(0))
|
|
332
|
+
self.assertEqual(abs_int.arg(2).arg(1), self.p)
|
|
333
|
+
|
|
334
|
+
# Test with real
|
|
335
|
+
abs_real = Abs(self.r)
|
|
336
|
+
|
|
337
|
+
# Verify the structure of the Abs node
|
|
338
|
+
self.assertTrue(abs_real.is_ite())
|
|
339
|
+
self.assertTrue(abs_real.arg(0).is_lt()) # GT is converted to LT with inverted args
|
|
340
|
+
self.assertEqual(abs_real.arg(0).arg(0), Real(0)) # First arg is 0
|
|
341
|
+
self.assertEqual(abs_real.arg(0).arg(1), self.r) # Second arg is r
|
|
342
|
+
self.assertEqual(abs_real.arg(1), self.r)
|
|
343
|
+
self.assertTrue(abs_real.arg(2).is_minus())
|
|
344
|
+
self.assertEqual(abs_real.arg(2).arg(0), Real(0))
|
|
345
|
+
self.assertEqual(abs_real.arg(2).arg(1), self.r)
|
|
346
|
+
|
|
347
|
+
# Test with boolean (should raise ValueError)
|
|
348
|
+
bool_var = Symbol("z", BOOL)
|
|
349
|
+
with self.assertRaises(ValueError):
|
|
350
|
+
Abs(bool_var)
|
|
351
|
+
|
|
320
352
|
def test_equals(self):
|
|
321
353
|
n = self.mgr.Equals(self.real_expr, self.real_expr)
|
|
322
354
|
self.assertIsNotNone(n)
|
|
@@ -18,8 +18,10 @@
|
|
|
18
18
|
import unittest
|
|
19
19
|
import tempfile, os
|
|
20
20
|
|
|
21
|
+
from fractions import Fraction
|
|
22
|
+
|
|
21
23
|
from pysmt.parsing import HRParser, parse
|
|
22
|
-
from pysmt.shortcuts import Iff, Symbol, And, Or, LE, Real, Plus, Minus
|
|
24
|
+
from pysmt.shortcuts import Iff, Symbol, And, Or, LE, GT, Real, Plus, Minus
|
|
23
25
|
from pysmt.test.examples import get_example_formulae
|
|
24
26
|
from pysmt.exceptions import NoSolverAvailableError
|
|
25
27
|
from pysmt.test import TestCase
|
|
@@ -76,6 +78,7 @@ class TestHRParser(TestCase):
|
|
|
76
78
|
p = HRParser()
|
|
77
79
|
for (f, _, _, _) in get_example_formulae():
|
|
78
80
|
s = f.serialize()
|
|
81
|
+
print(s)
|
|
79
82
|
res = p.parse(s)
|
|
80
83
|
check = (res == f)
|
|
81
84
|
if not check:
|
|
@@ -84,6 +87,12 @@ class TestHRParser(TestCase):
|
|
|
84
87
|
except NoSolverAvailableError:
|
|
85
88
|
pass
|
|
86
89
|
|
|
90
|
+
def test_substring(self):
|
|
91
|
+
p = HRParser()
|
|
92
|
+
s=Symbol('Intake_Pressure', REAL)
|
|
93
|
+
res = p.parse('(Intake_Pressure > 91.988 & Intake_Pressure<=116.892)')
|
|
94
|
+
print(res.serialize())
|
|
95
|
+
self.assertEqual(res, And(GT(s, Real(Fraction("91.988"))), LE(s, Real(Fraction("116.892")))))
|
|
87
96
|
|
|
88
97
|
|
|
89
98
|
if __name__ == '__main__':
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|