PySMT 0.9.7.dev112__py2.py3-none-any.whl → 0.9.7.dev120__py2.py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PySMT
3
- Version: 0.9.7.dev112
3
+ Version: 0.9.7.dev120
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,4 +1,4 @@
1
- pysmt/__init__.py,sha256=TKZ-kovL6HGfhI1GXWf0irhLNCok5tC7mk91ClJgyas,1598
1
+ pysmt/__init__.py,sha256=dli8l8X8OGsqNNZiY5ZZYpzc6VJ3SSe5_acL-gkslvk,1598
2
2
  pysmt/__main__.py,sha256=rR-MV1QtLYqtVoJyY3m5B5Iz-lua0-5o6YSB0W4lKy8,1085
3
3
  pysmt/configuration.py,sha256=q4Ncd6f2d0VZUpyQAOR8sTPlTodgDnYhUBeRgYYXqTE,4539
4
4
  pysmt/constants.py,sha256=QelM9r5fGWSq8UNjjYoEJK2FaLHRr4Z9NZxzjeajEWA,5249
@@ -7,7 +7,7 @@ pysmt/environment.py,sha256=rdaxQ0uwmMPmcW4d5WnTYAyHNSCpRTgzRLaXQccG5-4,6522
7
7
  pysmt/exceptions.py,sha256=uG3FochPO1Y18cv1lXUjQtNbW-qZKd68zqs8oo2OEF4,4420
8
8
  pysmt/factory.py,sha256=6QFbob7LV3x8uT4w2nG_rHqXWCqbwNg5oCUMPhpnwmY,24107
9
9
  pysmt/fnode.py,sha256=zKZP4yda8JxK6AXW3vCasRLYsLH5NzK_2Bjiy5ogtqo,33256
10
- pysmt/formula.py,sha256=baexe5-GgrG7z_qH3Wb9s8XQqFcBgyLXnv8Rik5t2YY,43318
10
+ pysmt/formula.py,sha256=gmK3b9481aI6rvHJTPZVOsw-YsIBFpeqKZ1-gdWHE2k,43371
11
11
  pysmt/logics.py,sha256=yJ1Yv24dVj4LlpnbspgcRT1t5e65RmvGas_bdHOGCAA,28774
12
12
  pysmt/operators.py,sha256=RU4H9E5eVjPgAar_9hIoCexq-Yc5v0xdHAMM69FcYX8,8132
13
13
  pysmt/oracles.py,sha256=lfRbPoiX4SXuJZktwmKUqA1FJ-7lRyP49LRIH8C7VoQ,19461
@@ -42,7 +42,7 @@ pysmt/smtlib/script.py,sha256=4tATsRYDavjz1DVKXzfVVZxVXYOtBRhh4Ya0Ng4XxHY,13387
42
42
  pysmt/smtlib/solver.py,sha256=dWBzYBuYDVyCsQI1KlqndxpqX4xHQUDcHAuefwbHv24,7987
43
43
  pysmt/smtlib/utils.py,sha256=XNp7mW1DB6cZRtQhkAOTR-xrwYaGDBEcF3Q-edKDeU8,2043
44
44
  pysmt/smtlib/parser/__init__.py,sha256=Tgl8AAjZPmCrABGmKRSC4Yu634mn8r22qn18M3u-pfk,4771
45
- pysmt/smtlib/parser/parser.py,sha256=3eMEhW6t2XHSK_1EkGmjB4ZWrg6kWgfwVDVcyOxyWS0,58387
45
+ pysmt/smtlib/parser/parser.py,sha256=vublFYMDAucq85WVaoq882WJ6kgcrRwUWh31bdH2u6M,58453
46
46
  pysmt/solvers/__init__.py,sha256=JXBHtcb4Lv-Sb8whc9JuGbRH2EBLWwtLUh3PL9HhNE8,650
47
47
  pysmt/solvers/bdd.py,sha256=my3398_-8Rkqy1pluzZa7_12qsA43ARbs8-YAPqdMWs,15938
48
48
  pysmt/solvers/btor.py,sha256=DFBnYsa4oG8GC58UWvKf6FHwVK9AmnOQ8ytrEaYlZbI,25295
@@ -89,7 +89,7 @@ pysmt/test/test_oracles.py,sha256=cHBPTUoi9cPmIvR-DG4bbzohOaBdUJzpKLoQXImxS_c,56
89
89
  pysmt/test/test_portfolio.py,sha256=k0Jdrdr-EX-BVCxqYNUS3YjC77aCpzzdhezjB8U3OCM,7125
90
90
  pysmt/test/test_printing.py,sha256=glsnaMRungLc31JIJTmHlT69JnTPsC5pnYn1rZriV2s,8765
91
91
  pysmt/test/test_qe.py,sha256=k8zYX-lcij0ua9yuRXl7wErUklEgLSEh68QDpV8J9xs,7157
92
- pysmt/test/test_regressions.py,sha256=OHBptJUWQnUkXT17VH4z9Qea0QQeUF2v4sw_RYyottE,20119
92
+ pysmt/test/test_regressions.py,sha256=RnZmdszTOIbDnMZ7wjVnMwdboJCcObtQeM0YumLd3ng,20400
93
93
  pysmt/test/test_rewritings.py,sha256=1eeseDwZyQD2VrOFBABXHTYJFJOXszP4olbCNeLcwfA,15607
94
94
  pysmt/test/test_shannon_expansion.py,sha256=yaiZuB24wj1Zi-KdzRTmWuzAVaF9bQ603uto7zi6XBs,3082
95
95
  pysmt/test/test_simplify.py,sha256=ckQn_DUxVvGspaRNZmSPHkudhpUlG5K2w6C0wDqhL1w,7620
@@ -97,7 +97,7 @@ pysmt/test/test_size.py,sha256=p3aqCMHfBiGLxvF0P8hE-PRQTT8VMPIJCjblq8Txh1w,3261
97
97
  pysmt/test/test_solving.py,sha256=8x9dNHbICFzHmCLZDR_Nnm3ScRal6seGoRRA89uOB4w,24906
98
98
  pysmt/test/test_sorts.py,sha256=erfInyPH91WVB8JBUYLteTo5X5skKKP3vEXdUUKC-YE,6033
99
99
  pysmt/test/test_string.py,sha256=Y6VBfkLNKuePo8-HIzcwBH3eaYj0i-k1Y8tpFyw03zw,8096
100
- pysmt/test/test_typechecker.py,sha256=obrRf5LSkrZjw2Kn7B4WNWVUykE7c9tU3jW-dEteHBs,6977
100
+ pysmt/test/test_typechecker.py,sha256=S2O8HjN_bLN6sz86TnsWqpRtxHk2VcVsGDoRZCcQnzE,7309
101
101
  pysmt/test/test_unsat_cores.py,sha256=J-ip4SInZ9l96NCsLsKmvIiSI04hKpdyrPeKRh6b6aM,6563
102
102
  pysmt/test/test_walker_ext.py,sha256=4x6Ew522P_0fLpKRIL0_0igB4I3_VrWWA4juuqolhag,3522
103
103
  pysmt/test/test_walkers.py,sha256=AKVMvEUtMBht08bE1vCMaeMtdgGa6j_weDSHz_9Br3Q,9481
@@ -122,16 +122,16 @@ pysmt/test/smtlib/test_parser_qf_nra.py,sha256=a6VWFQtv_v2bqLe598NTdcK1v9cM9Q3lo
122
122
  pysmt/test/smtlib/test_parser_qf_uf.py,sha256=iKWadVfvZEKkjuP0lXo3BoEk3ISoDYyi_x4MhTt6Q_Q,978
123
123
  pysmt/test/smtlib/test_parser_qf_ufbv.py,sha256=G3Nnt4awK1A6nwDvKRv4zoFwtGHawvlf4KSVYJRltGA,984
124
124
  pysmt/test/smtlib/test_parser_type_error.py,sha256=cnil1KNDYkxc52pnqOC1ch8joGbaWWqepQmYABtTHLM,1129
125
- pysmt/test/smtlib/test_smtlibscript.py,sha256=x-ukB65HeccNZ9I3GUxvOf8MHCyfzc8qKBXgtQwOgmg,11013
125
+ pysmt/test/smtlib/test_smtlibscript.py,sha256=pGNEPwCinr0oIAYbp0kx4dkczi5Z5frHKTzOdlwf350,11930
126
126
  pysmt/walkers/__init__.py,sha256=D6iHibVpqaZFzcpgYnNf3NVMxPyouAeeonTDSwCToRg,1585
127
127
  pysmt/walkers/dag.py,sha256=pUdVTZx7CQyjrAb6jMfmsqS07J4kiDqHU8R4_9UvwkQ,5352
128
128
  pysmt/walkers/generic.py,sha256=q1j1T2RvCeJn1PM0H5d8vNV4FTYAEQgT7h8X5DJhDf8,4534
129
129
  pysmt/walkers/identitydag.py,sha256=f_D5qA198ayd3QO4u59fBX1RS_UiSBnPeV9O3ULvQv0,8737
130
130
  pysmt/walkers/tree.py,sha256=WIWN9IM0riWkaD40iP4Tt3BCN21iSdE1S7gRZqy56SU,2846
131
- PySMT-0.9.7.dev112.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
132
- PySMT-0.9.7.dev112.dist-info/METADATA,sha256=jyBArgrTBLc7CC6a2QaWphz8zjnXBWJdPLC5jIdbv4o,1617
133
- PySMT-0.9.7.dev112.dist-info/NOTICE,sha256=Ns-Jsa6nbqZUiTEEAM6HqioSZIxQ2RCJzxoBlWQaUfc,601
134
- PySMT-0.9.7.dev112.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
135
- PySMT-0.9.7.dev112.dist-info/entry_points.txt,sha256=si0hIk-v3V35G3p8QGINoQ4QW-v4RYDRqj-asgyCgeM,58
136
- PySMT-0.9.7.dev112.dist-info/top_level.txt,sha256=NwHQbpTaZMEvjIUdC0bvvj-WUyULe-nt-opK3YQNRMk,6
137
- PySMT-0.9.7.dev112.dist-info/RECORD,,
131
+ PySMT-0.9.7.dev120.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
132
+ PySMT-0.9.7.dev120.dist-info/METADATA,sha256=6aV6YWUZW41vmf7oz0YYqSUo4bkzIsUeEZhczJT6WWg,1617
133
+ PySMT-0.9.7.dev120.dist-info/NOTICE,sha256=Ns-Jsa6nbqZUiTEEAM6HqioSZIxQ2RCJzxoBlWQaUfc,601
134
+ PySMT-0.9.7.dev120.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
135
+ PySMT-0.9.7.dev120.dist-info/entry_points.txt,sha256=si0hIk-v3V35G3p8QGINoQ4QW-v4RYDRqj-asgyCgeM,58
136
+ PySMT-0.9.7.dev120.dist-info/top_level.txt,sha256=NwHQbpTaZMEvjIUdC0bvvj-WUyULe-nt-opK3YQNRMk,6
137
+ PySMT-0.9.7.dev120.dist-info/RECORD,,
pysmt/__init__.py CHANGED
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- VERSION = (0, 9, 7, "dev", 112)
19
+ VERSION = (0, 9, 7, "dev", 120)
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
pysmt/formula.py CHANGED
@@ -89,7 +89,9 @@ class FormulaManager(object):
89
89
  def create_node(self, node_type, args, payload=None):
90
90
  content = FNodeContent(node_type, args, payload)
91
91
  if content in self.formulae:
92
- return self.formulae[content]
92
+ n = self.formulae[content]
93
+ self._do_type_check(n)
94
+ return n
93
95
  else:
94
96
  n = FNode(content, self._next_free_id)
95
97
  self._next_free_id += 1
@@ -344,13 +344,15 @@ class SmtLibParser(object):
344
344
  get_type = self.env.stc.get_type
345
345
  get_free_variables = self.env.fvo.get_free_variables
346
346
  new_args = []
347
+ changed = False
347
348
  for x in args:
348
349
  if get_type(x).is_int_type() and\
349
350
  len(get_free_variables(x)) == 0:
350
351
  new_args.append(mgr.ToReal(x))
352
+ changed = True
351
353
  else:
352
354
  new_args.append(x)
353
- if args == new_args:
355
+ if not changed:
354
356
  raise
355
357
  return op(*new_args)
356
358
 
@@ -27,7 +27,7 @@ from pysmt.smtlib.script import smtlibscript_from_formula, evaluate_command
27
27
  from pysmt.smtlib.parser import get_formula_strict, get_formula, SmtLibParser
28
28
  from pysmt.solvers.smtlib import SmtLibIgnoreMixin
29
29
  from pysmt.logics import QF_UFLIRA
30
- from pysmt.exceptions import UndefinedLogicError, PysmtValueError
30
+ from pysmt.exceptions import UndefinedLogicError, PysmtValueError, PysmtTypeError
31
31
 
32
32
 
33
33
 
@@ -175,6 +175,29 @@ class TestSmtLibScript(TestCase):
175
175
  # No exceptions are thrown
176
176
  self.assertEqual(smtlib_script.replace('var', '__var0'), script.commands[0].serialize_to_string())
177
177
 
178
+ def test_twice_fix_real(self):
179
+ smtlib_script = "\n".join([
180
+ '(declare-fun r () Real)',
181
+ '(assert (< (* 1 r) 0))',
182
+ '(assert (< 2 (* 1 r)))'
183
+ ])
184
+ stream = StringIO(smtlib_script)
185
+ parser = SmtLibParser()
186
+ _ = parser.get_script(stream)
187
+ # No exceptions are thrown
188
+ self.assertTrue(True)
189
+
190
+ def test_type_error(self):
191
+ smtlib_script = "\n".join([
192
+ "(declare-sort B 0)",
193
+ "(declare-const e B)",
194
+ "(declare-const x Bool)",
195
+ "(assert (= e x))",
196
+ ])
197
+ stream = StringIO(smtlib_script)
198
+ parser = SmtLibParser()
199
+ with self.assertRaises(PysmtTypeError):
200
+ _ = parser.get_script(stream)
178
201
 
179
202
  def test_evaluate_command(self):
180
203
  class SmtLibIgnore(SmtLibIgnoreMixin):
@@ -233,14 +256,19 @@ class TestSmtLibScript(TestCase):
233
256
  # Create a small file that tests all commands of smt-lib 2
234
257
  parser = SmtLibParser()
235
258
 
259
+ te = 0
236
260
  nie = 0
237
261
  for cmd in DEMO_SMTSCRIPT:
238
262
  try:
239
263
  next(parser.get_command_generator(StringIO(cmd)))
240
264
  except NotImplementedError:
241
265
  nie += 1
266
+ except PysmtTypeError:
267
+ te += 1
242
268
  # There are currently 3 not-implemented commands
243
269
  self.assertEqual(nie, 3)
270
+ # There is currently 1 type error
271
+ self.assertEqual(te, 1)
244
272
 
245
273
  DEMO_SMTSCRIPT = [ "(declare-fun a () Bool)",
246
274
  "(declare-fun b () Bool)",
@@ -456,13 +456,20 @@ class TestRegressions(TestCase):
456
456
  self.assertEqual(ex.pos_info[1], 19)
457
457
 
458
458
  def test_parse_bvconst_width(self):
459
- smtlib_input = "(assert (> #x10 #x10))"
459
+ smtlib_input = "(assert (bvugt #x10 #x10))"
460
460
  parser = SmtLibParser()
461
461
  buffer_ = StringIO(smtlib_input)
462
462
  expr = parser.get_script(buffer_).get_last_formula()
463
463
  const = expr.args()[0]
464
464
  self.assertEqual(const.bv_width(), 8, const.bv_width())
465
465
 
466
+ def test_parse_bvconst_type_check(self):
467
+ smtlib_input = "(assert (> #x10 #x10))"
468
+ parser = SmtLibParser()
469
+ buffer_ = StringIO(smtlib_input)
470
+ with self.assertRaises(PysmtTypeError):
471
+ _ = parser.get_script(buffer_).get_last_formula()
472
+
466
473
  def test_equality_typing(self):
467
474
  x = Symbol('x', BOOL)
468
475
  y = Symbol('y', BOOL)
@@ -212,6 +212,15 @@ class TestSimpleTypeChecker(TestCase):
212
212
  with self.assertRaises(PysmtTypeError):
213
213
  super_bad_function()
214
214
 
215
+ def test_multiple_creations(self):
216
+ def bad_formula():
217
+ return Times(self.p, self.r)
218
+ with self.assertRaises(PysmtTypeError):
219
+ bad_formula()
220
+ # When building the same formula a second time, should raise again.
221
+ with self.assertRaises(PysmtTypeError):
222
+ bad_formula()
223
+
215
224
  def test_examples(self):
216
225
  for (f, _, _, _) in get_example_formulae():
217
226
  self.assertIs(f.get_type(), BOOL, f)