PySMT 0.9.7.dev120__tar.gz → 0.9.7.dev129__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.
Files changed (149) hide show
  1. {PySMT-0.9.7.dev120/PySMT.egg-info → PySMT-0.9.7.dev129}/PKG-INFO +1 -1
  2. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129/PySMT.egg-info}/PKG-INFO +1 -1
  3. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/__init__.py +1 -1
  4. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/installers/btor.py +23 -0
  5. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/parsing.py +21 -16
  6. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/shortcuts.py +25 -0
  7. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/btor.py +17 -0
  8. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_formula.py +33 -1
  9. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_hr_parsing.py +10 -1
  10. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/LICENSE +0 -0
  11. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/MANIFEST.in +0 -0
  12. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/NOTICE +0 -0
  13. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/PySMT.egg-info/SOURCES.txt +0 -0
  14. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/PySMT.egg-info/dependency_links.txt +0 -0
  15. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/PySMT.egg-info/entry_points.txt +0 -0
  16. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/PySMT.egg-info/top_level.txt +0 -0
  17. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/README.rst +0 -0
  18. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/docs/CHANGES.rst +0 -0
  19. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/docs/api_ref.rst +0 -0
  20. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/docs/development.rst +0 -0
  21. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/docs/getting_started.rst +0 -0
  22. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/docs/index.rst +0 -0
  23. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/docs/tutorials/boolean_logic.rst +0 -0
  24. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/docs/tutorials.rst +0 -0
  25. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/__main__.py +0 -0
  26. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/__init__.py +0 -0
  27. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/check_version.py +0 -0
  28. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/install.py +0 -0
  29. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/installers/__init__.py +0 -0
  30. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/installers/base.py +0 -0
  31. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/installers/bdd.py +0 -0
  32. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/installers/cvcfive.py +0 -0
  33. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/installers/cvcfour.py +0 -0
  34. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/installers/msat.py +0 -0
  35. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/installers/pico.py +0 -0
  36. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/installers/yices.py +0 -0
  37. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/installers/z3.py +0 -0
  38. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/cmd/shell.py +0 -0
  39. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/configuration.py +0 -0
  40. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/constants.py +0 -0
  41. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/decorators.py +0 -0
  42. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/environment.py +0 -0
  43. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/exceptions.py +0 -0
  44. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/factory.py +0 -0
  45. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/fnode.py +0 -0
  46. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/formula.py +0 -0
  47. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/logics.py +0 -0
  48. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/operators.py +0 -0
  49. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/oracles.py +0 -0
  50. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/printers.py +0 -0
  51. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/rewritings.py +0 -0
  52. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/simplifier.py +0 -0
  53. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/smtlib/__init__.py +0 -0
  54. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/smtlib/annotations.py +0 -0
  55. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/smtlib/commands.py +0 -0
  56. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/smtlib/parser/__init__.py +0 -0
  57. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/smtlib/parser/parser.py +0 -0
  58. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/smtlib/printers.py +0 -0
  59. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/smtlib/script.py +0 -0
  60. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/smtlib/solver.py +0 -0
  61. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/smtlib/utils.py +0 -0
  62. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/__init__.py +0 -0
  63. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/bdd.py +0 -0
  64. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/cvcfive.py +0 -0
  65. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/cvcfour.py +0 -0
  66. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/eager.py +0 -0
  67. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/interpolation.py +0 -0
  68. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/msat.py +0 -0
  69. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/options.py +0 -0
  70. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/pico.py +0 -0
  71. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/portfolio.py +0 -0
  72. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/qelim.py +0 -0
  73. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/smtlib.py +0 -0
  74. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/solver.py +0 -0
  75. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/yices.py +0 -0
  76. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/solvers/z3.py +0 -0
  77. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/substituter.py +0 -0
  78. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/__init__.py +0 -0
  79. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/configs/config1.ini +0 -0
  80. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/configs/config_bad.ini +0 -0
  81. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/examples.py +0 -0
  82. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/__init__.py +0 -0
  83. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/parser_utils.py +0 -0
  84. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_annotations.py +0 -0
  85. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_fuzzed.py +0 -0
  86. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_generic_wrapper.py +0 -0
  87. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_griggio.py +0 -0
  88. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_model_validation.py +0 -0
  89. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_parser_examples.py +0 -0
  90. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_parser_extensibility.py +0 -0
  91. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_parser_lra.py +0 -0
  92. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_parser_qf_arrays.py +0 -0
  93. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_parser_qf_lia.py +0 -0
  94. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_parser_qf_lira.py +0 -0
  95. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_parser_qf_lra.py +0 -0
  96. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_parser_qf_nia.py +0 -0
  97. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_parser_qf_nra.py +0 -0
  98. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_parser_qf_uf.py +0 -0
  99. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_parser_qf_ufbv.py +0 -0
  100. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_parser_type_error.py +0 -0
  101. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/smtlib/test_smtlibscript.py +0 -0
  102. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_array.py +0 -0
  103. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_back.py +0 -0
  104. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_bdd.py +0 -0
  105. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_bv.py +0 -0
  106. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_bv_simplification.py +0 -0
  107. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_cnf.py +0 -0
  108. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_configuration.py +0 -0
  109. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_constants.py +0 -0
  110. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_cvc_quantifiers.py +0 -0
  111. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_dwf.py +0 -0
  112. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_eager_model.py +0 -0
  113. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_env.py +0 -0
  114. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_euf.py +0 -0
  115. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_imports.py +0 -0
  116. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_int.py +0 -0
  117. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_interpolation.py +0 -0
  118. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_lira.py +0 -0
  119. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_logics.py +0 -0
  120. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_models.py +0 -0
  121. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_native_qe.py +0 -0
  122. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_nia.py +0 -0
  123. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_nlira.py +0 -0
  124. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_oracles.py +0 -0
  125. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_portfolio.py +0 -0
  126. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_printing.py +0 -0
  127. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_qe.py +0 -0
  128. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_regressions.py +0 -0
  129. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_rewritings.py +0 -0
  130. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_shannon_expansion.py +0 -0
  131. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_simplify.py +0 -0
  132. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_size.py +0 -0
  133. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_solving.py +0 -0
  134. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_sorts.py +0 -0
  135. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_string.py +0 -0
  136. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_typechecker.py +0 -0
  137. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_unsat_cores.py +0 -0
  138. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_walker_ext.py +0 -0
  139. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/test/test_walkers.py +0 -0
  140. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/type_checker.py +0 -0
  141. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/typing.py +0 -0
  142. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/utils.py +0 -0
  143. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/walkers/__init__.py +0 -0
  144. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/walkers/dag.py +0 -0
  145. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/walkers/generic.py +0 -0
  146. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/walkers/identitydag.py +0 -0
  147. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/pysmt/walkers/tree.py +0 -0
  148. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/setup.cfg +0 -0
  149. {PySMT-0.9.7.dev120 → PySMT-0.9.7.dev129}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: PySMT
3
- Version: 0.9.7.dev120
3
+ Version: 0.9.7.dev129
4
4
  Summary: A solver-agnostic library for SMT Formulae manipulation and solving
5
5
  Home-page: http://www.pysmt.org
6
6
  Author: PySMT Team
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: PySMT
3
- Version: 0.9.7.dev120
3
+ Version: 0.9.7.dev129
4
4
  Summary: A solver-agnostic library for SMT Formulae manipulation and solving
5
5
  Home-page: http://www.pysmt.org
6
6
  Author: PySMT Team
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- VERSION = (0, 9, 7, "dev", 120)
19
+ VERSION = (0, 9, 7, "dev", 129)
20
20
 
21
21
  # Try to provide human-readable version of latest commit for dev versions
22
22
  # E.g. v0.5.1-4-g49a49f2-wip
@@ -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"(xor)", InfixOpAdapter(self.mgr.BVXor, 10), False),# BVXor
176
- Rule(r"(ROR)", InfixOpAdapter(self.BVHack(self.mgr.BVRor), 90), False),# BVRor
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):
@@ -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
 
@@ -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