z3 0.0.20220203 → 0.0.20220320

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +0 -0
  3. data/README.md +0 -0
  4. data/Rakefile +0 -0
  5. data/examples/abc_path-1.txt +0 -0
  6. data/examples/aquarium-1.txt +0 -0
  7. data/examples/bridges-1.txt +0 -0
  8. data/examples/cats_organized_neatly-10.txt +0 -0
  9. data/examples/cats_organized_neatly-3.txt +0 -0
  10. data/examples/cats_organized_neatly-48.txt +0 -0
  11. data/examples/color_nonogram-1.txt +0 -0
  12. data/examples/dominion-1.txt +0 -0
  13. data/examples/dominosa-1.txt +0 -0
  14. data/examples/eulero-1.txt +0 -0
  15. data/examples/futoshiki-1.txt +0 -0
  16. data/examples/kakurasu-1.txt +0 -0
  17. data/examples/kakuro-1.txt +0 -0
  18. data/examples/killer_sudoku-1.txt +0 -0
  19. data/examples/killer_sudoku-2.txt +0 -0
  20. data/examples/kropki-1.txt +0 -0
  21. data/examples/letter_connections-1.txt +0 -0
  22. data/examples/light_up-1.txt +0 -0
  23. data/examples/minisudoku-1.txt +0 -0
  24. data/examples/miracle_sudoku-1.txt +0 -0
  25. data/examples/mortal_coil_puzzle-9.txt +0 -0
  26. data/examples/nanro-1.txt +0 -0
  27. data/examples/regexp_crossword/beginner-1.txt +0 -0
  28. data/examples/regexp_crossword/beginner-2.txt +0 -0
  29. data/examples/regexp_crossword/beginner-3.txt +0 -0
  30. data/examples/regexp_crossword/beginner-4.txt +0 -0
  31. data/examples/regexp_crossword/beginner-5.txt +0 -0
  32. data/examples/regexp_crossword/experienced-1.txt +0 -0
  33. data/examples/regexp_crossword/experienced-2.txt +0 -0
  34. data/examples/regexp_crossword/experienced-3.txt +0 -0
  35. data/examples/regexp_crossword/experienced-4.txt +0 -0
  36. data/examples/regexp_crossword/experienced-5.txt +0 -0
  37. data/examples/regexp_crossword/tutorial-1.txt +0 -0
  38. data/examples/regexp_crossword/tutorial-2.txt +0 -0
  39. data/examples/regexp_crossword/tutorial-3.txt +0 -0
  40. data/examples/regexp_crossword/tutorial-4.txt +0 -0
  41. data/examples/regexp_crossword/tutorial-5.txt +0 -0
  42. data/examples/regexp_crossword/tutorial-6.txt +0 -0
  43. data/examples/regexp_crossword/tutorial-7.txt +0 -0
  44. data/examples/regexp_crossword/tutorial-8.txt +0 -0
  45. data/examples/regexp_crossword/tutorial-9.txt +0 -0
  46. data/examples/regexp_string_matcher.rb +0 -0
  47. data/examples/renzoku-1.txt +0 -0
  48. data/examples/sandwich_sudoku-1.txt +0 -0
  49. data/examples/simple_regexp_parser.rb +0 -0
  50. data/examples/skyscrapers-1.txt +0 -0
  51. data/examples/skyscrapers-2.txt +0 -0
  52. data/examples/star_battle-1.txt +0 -0
  53. data/examples/stitches-1.txt +0 -0
  54. data/examples/sudoku-1.txt +0 -0
  55. data/examples/suguru-1.txt +0 -0
  56. data/examples/yajilin-1.txt +0 -0
  57. data/lib/z3/ast.rb +0 -0
  58. data/lib/z3/context.rb +0 -0
  59. data/lib/z3/exception.rb +0 -0
  60. data/lib/z3/expr/arith_expr.rb +0 -0
  61. data/lib/z3/expr/array_expr.rb +0 -0
  62. data/lib/z3/expr/bitvec_expr.rb +47 -2
  63. data/lib/z3/expr/bool_expr.rb +0 -0
  64. data/lib/z3/expr/expr.rb +0 -0
  65. data/lib/z3/expr/float_expr.rb +0 -0
  66. data/lib/z3/expr/int_expr.rb +0 -0
  67. data/lib/z3/expr/real_expr.rb +0 -0
  68. data/lib/z3/expr/rounding_mode_expr.rb +0 -0
  69. data/lib/z3/expr/set_expr.rb +0 -0
  70. data/lib/z3/func_decl.rb +0 -0
  71. data/lib/z3/goal.rb +0 -0
  72. data/lib/z3/hacks.rb +0 -0
  73. data/lib/z3/interface.rb +0 -0
  74. data/lib/z3/low_level.rb +0 -0
  75. data/lib/z3/low_level_auto.rb +0 -0
  76. data/lib/z3/model.rb +0 -0
  77. data/lib/z3/optimize.rb +0 -0
  78. data/lib/z3/printer.rb +0 -0
  79. data/lib/z3/probe.rb +0 -0
  80. data/lib/z3/solver.rb +0 -0
  81. data/lib/z3/sort/array_sort.rb +0 -0
  82. data/lib/z3/sort/bitvec_sort.rb +0 -0
  83. data/lib/z3/sort/bool_sort.rb +0 -0
  84. data/lib/z3/sort/float_sort.rb +0 -0
  85. data/lib/z3/sort/int_sort.rb +0 -0
  86. data/lib/z3/sort/real_sort.rb +0 -0
  87. data/lib/z3/sort/rounding_mode_sort.rb +0 -0
  88. data/lib/z3/sort/set_sort.rb +0 -0
  89. data/lib/z3/sort/sort.rb +0 -0
  90. data/lib/z3/tactic.rb +0 -0
  91. data/lib/z3/very_low_level.rb +0 -0
  92. data/lib/z3/very_low_level_auto.rb +0 -0
  93. data/lib/z3.rb +0 -0
  94. data/spec/array_expr_spec.rb +0 -0
  95. data/spec/array_sort_spec.rb +0 -0
  96. data/spec/bitvec_expr_spec.rb +13 -0
  97. data/spec/bitvec_sort_spec.rb +0 -0
  98. data/spec/bool_expr_spec.rb +0 -0
  99. data/spec/bool_sort_spec.rb +0 -0
  100. data/spec/coverage_helper.rb +0 -0
  101. data/spec/expr_spec.rb +0 -0
  102. data/spec/float_expr_spec.rb +0 -0
  103. data/spec/float_sort_spec.rb +0 -0
  104. data/spec/goal_spec.rb +0 -0
  105. data/spec/int_expr_spec.rb +0 -0
  106. data/spec/int_sort_spec.rb +0 -0
  107. data/spec/integration/abc_path_spec.rb +0 -0
  108. data/spec/integration/algebra_problems_spec.rb +0 -0
  109. data/spec/integration/aquarium_spec.rb +0 -0
  110. data/spec/integration/basic_int_math_spec.rb +0 -0
  111. data/spec/integration/basic_logic_spec.rb +0 -0
  112. data/spec/integration/bit_tricks_spec.rb +0 -0
  113. data/spec/integration/bridges_spec.rb +0 -0
  114. data/spec/integration/cats_organized_neatly_spec.rb +0 -0
  115. data/spec/integration/cicruit_problem_spec.rb +0 -0
  116. data/spec/integration/color_nonogram_spec.rb +0 -0
  117. data/spec/integration/crossflip_spec.rb +0 -0
  118. data/spec/integration/dominion_spec.rb +0 -0
  119. data/spec/integration/dominosa_spec.rb +0 -0
  120. data/spec/integration/eulero_spec.rb +0 -0
  121. data/spec/integration/four_hackers_puzzle_spec.rb +0 -0
  122. data/spec/integration/futoshiki_spec.rb +0 -0
  123. data/spec/integration/geometry_problem_spec.rb +0 -0
  124. data/spec/integration/kakurasu_spec.rb +0 -0
  125. data/spec/integration/kakuro_spec.rb +0 -0
  126. data/spec/integration/killer_sudoku_spec.rb +0 -0
  127. data/spec/integration/kinematics_problems_spec.rb +0 -0
  128. data/spec/integration/knights_puzzle_spec.rb +0 -0
  129. data/spec/integration/kropki_spec.rb +0 -0
  130. data/spec/integration/letter_connections_spec.rb +0 -0
  131. data/spec/integration/light_up_spec.rb +0 -0
  132. data/spec/integration/minisudoku_spec.rb +0 -0
  133. data/spec/integration/miracle_sudoku_spec.rb +0 -0
  134. data/spec/integration/mortal_coil_puzzle_spec.rb +0 -0
  135. data/spec/integration/nanro_spec.rb +0 -0
  136. data/spec/integration/nine_clocks_spec.rb +0 -0
  137. data/spec/integration/nonogram_spec.rb +0 -0
  138. data/spec/integration/oneofus_spec.rb +0 -0
  139. data/spec/integration/pyramid_nonogram_spec.rb +0 -0
  140. data/spec/integration/regexp_crossword_solver_spec.rb +0 -0
  141. data/spec/integration/regexp_solver_spec.rb +0 -0
  142. data/spec/integration/renzoku_spec.rb +0 -0
  143. data/spec/integration/sandwich_sudoku_spec.rb +0 -0
  144. data/spec/integration/selfref_spec.rb +0 -0
  145. data/spec/integration/skyscraper_spec.rb +0 -0
  146. data/spec/integration/star_battle_spec.rb +0 -0
  147. data/spec/integration/stitches_spec.rb +0 -0
  148. data/spec/integration/sudoku_spec.rb +0 -0
  149. data/spec/integration/suguru_spec.rb +0 -0
  150. data/spec/integration/verbal_arithmetic_spec.rb +0 -0
  151. data/spec/integration/yajilin_spec.rb +0 -0
  152. data/spec/integration/zebra_puzzle_spec.rb +0 -0
  153. data/spec/interface_spec.rb +0 -0
  154. data/spec/model_spec.rb +0 -0
  155. data/spec/optimize_spec.rb +0 -0
  156. data/spec/printer_spec.rb +0 -0
  157. data/spec/probe_spec.rb +0 -0
  158. data/spec/real_expr_spec.rb +0 -0
  159. data/spec/real_sort_spec.rb +0 -0
  160. data/spec/rounding_mode_expr_spec.rb +0 -0
  161. data/spec/rounding_mode_sort_spec.rb +0 -0
  162. data/spec/set_expr_spec.rb +0 -0
  163. data/spec/set_sort_spec.rb +0 -0
  164. data/spec/solver_spec.rb +0 -0
  165. data/spec/sort_spec.rb +0 -0
  166. data/spec/spec_helper.rb +0 -0
  167. data/spec/tactic_spec.rb +0 -0
  168. data/spec/z3_spec.rb +0 -0
  169. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7d242f957aeaacf005f52841ebc5eaa0b1ecd507cc6d1f80c6ca0f9d2303813
4
- data.tar.gz: 926ecb103b3a90f45defb57e90610eeb6b67f160a0f2b5bf64ed448df26e87d7
3
+ metadata.gz: 66d1bea928681fdde1b5e1314825832a73a7799008ea43acf31d9f3a2130616d
4
+ data.tar.gz: f0359749f08556ec7b33ad51118ed9f02f829d4d116246ea7241c37da91b516a
5
5
  SHA512:
6
- metadata.gz: 76e3973739810e87ae9fed8765c9a8e7c96efac5a02c100cacfc8a3087f005ac6d866a251defe84a5f79dcec9991a98adef58ea64eb57ede5923a54e41f5a262
7
- data.tar.gz: e1c805dc4185374113cb639133d4546df210ab9ceb7dd65be2dd6a82ddfb9d1930f31f7d9a6830fa0a82c217c6eeec3a04a4f720e9ab70fcb48dad3d21824387
6
+ metadata.gz: 89ff9d1b9273f6395d955ee0bf52a00f4c94e44a932f88ca2f33e9e38ae9a539e8887b1f2e0845296a36eda454d06873fd405d905e4022d3cabad437005ebaf5
7
+ data.tar.gz: c42b4bbc1211f319a06d82ac9442cfe6341238319b2ae9f4f1ba9deaf482607fa3ced8aaedd77249586b45d89ff990ef111d5476b5695bad855e0a1e788f13fd
data/.rspec CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
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
data/examples/nanro-1.txt CHANGED
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
data/lib/z3/ast.rb CHANGED
File without changes
data/lib/z3/context.rb CHANGED
File without changes
data/lib/z3/exception.rb CHANGED
File without changes
File without changes
File without changes
@@ -49,11 +49,31 @@ module Z3
49
49
  end
50
50
 
51
51
  def /(other)
52
- raise "Use signed_div or unsigned_div"
52
+ raise Z3::Exception, "Use signed_div or unsigned_div"
53
+ end
54
+
55
+ def signed_div(other)
56
+ BitvecExpr.SignedDiv(self, other)
57
+ end
58
+
59
+ def unsigned_div(other)
60
+ BitvecExpr.UnsignedDiv(self, other)
53
61
  end
54
62
 
55
63
  def %(other)
56
- raise "Use signed_mod or signed_rem or unsigned_rem"
64
+ raise Z3::Exception, "Use signed_mod or signed_rem or unsigned_rem"
65
+ end
66
+
67
+ def signed_mod(other)
68
+ BitvecExpr.SignedMod(self, other)
69
+ end
70
+
71
+ def signed_rem(other)
72
+ BitvecExpr.SignedRem(self, other)
73
+ end
74
+
75
+ def unsigned_rem(other)
76
+ BitvecExpr.UnsignedRem(self, other)
57
77
  end
58
78
 
59
79
  def rotate_left(num)
@@ -257,6 +277,31 @@ module Z3
257
277
  a.sort.new(LowLevel.mk_bvshl(a, b))
258
278
  end
259
279
 
280
+ def SignedDiv(a, b)
281
+ a, b = coerce_to_same_bv_sort(a, b)
282
+ a.sort.new(LowLevel.mk_bvsdiv(a, b))
283
+ end
284
+
285
+ def UnsignedDiv(a, b)
286
+ a, b = coerce_to_same_bv_sort(a, b)
287
+ a.sort.new(LowLevel.mk_bvudiv(a, b))
288
+ end
289
+
290
+ def SignedMod(a, b)
291
+ a, b = coerce_to_same_bv_sort(a, b)
292
+ a.sort.new(LowLevel.mk_bvsmod(a, b))
293
+ end
294
+
295
+ def SignedRem(a, b)
296
+ a, b = coerce_to_same_bv_sort(a, b)
297
+ a.sort.new(LowLevel.mk_bvsrem(a, b))
298
+ end
299
+
300
+ def UnsignedRem(a, b)
301
+ a, b = coerce_to_same_bv_sort(a, b)
302
+ a.sort.new(LowLevel.mk_bvurem(a, b))
303
+ end
304
+
260
305
  def Xnor(*args)
261
306
  args = coerce_to_same_bv_sort(*args)
262
307
  args.inject do |a,b|
File without changes
data/lib/z3/expr/expr.rb CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/lib/z3/func_decl.rb CHANGED
File without changes
data/lib/z3/goal.rb CHANGED
File without changes
data/lib/z3/hacks.rb CHANGED
File without changes
data/lib/z3/interface.rb CHANGED
File without changes
data/lib/z3/low_level.rb CHANGED
File without changes
File without changes
data/lib/z3/model.rb CHANGED
File without changes
data/lib/z3/optimize.rb CHANGED
File without changes
data/lib/z3/printer.rb CHANGED
File without changes
data/lib/z3/probe.rb CHANGED
File without changes
data/lib/z3/solver.rb CHANGED
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
data/lib/z3/sort/sort.rb CHANGED
File without changes
data/lib/z3/tactic.rb CHANGED
File without changes
File without changes
File without changes
data/lib/z3.rb CHANGED
File without changes
File without changes
File without changes
@@ -36,6 +36,19 @@ module Z3
36
36
  expect([a == 30, b == 42, c == (a * b)]).to have_solution(c => 236)
37
37
  end
38
38
 
39
+ it "/" do
40
+ expect{ a / b }.to raise_error(Z3::Exception)
41
+ expect([a == 200, b == 20, c == a.unsigned_div(b)]).to have_solution(c => 10)
42
+ expect([a == 200, b == 20, c == a.signed_div(b)]).to have_solution(c => 254)
43
+ end
44
+
45
+ it "%" do
46
+ expect{ a % b }.to raise_error(Z3::Exception)
47
+ expect([a == 200, b == 20, c == a.signed_mod(b)]).to have_solution(c => 4)
48
+ expect([a == 200, b == 20, c == a.signed_rem(b)]).to have_solution(c => 240)
49
+ expect([a == 200, b == 20, c == a.unsigned_rem(b)]).to have_solution(c => 0)
50
+ end
51
+
39
52
  it "&" do
40
53
  expect([a == 50, b == 27, c == (a & b)]).to have_solution(c => 18)
41
54
  end
File without changes
File without changes
File without changes
File without changes
data/spec/expr_spec.rb CHANGED
File without changes
File without changes
File without changes
data/spec/goal_spec.rb CHANGED
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
data/spec/model_spec.rb CHANGED
File without changes
File without changes
data/spec/printer_spec.rb CHANGED
File without changes
data/spec/probe_spec.rb CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/spec/solver_spec.rb CHANGED
File without changes
data/spec/sort_spec.rb CHANGED
File without changes
data/spec/spec_helper.rb CHANGED
File without changes
data/spec/tactic_spec.rb CHANGED
File without changes
data/spec/z3_spec.rb CHANGED
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: z3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20220203
4
+ version: 0.0.20220320
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Wegrzanowski
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-03 00:00:00.000000000 Z
11
+ date: 2022-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -333,7 +333,7 @@ licenses:
333
333
  - MIT
334
334
  metadata:
335
335
  msys2_mingw_dependencies: z3
336
- post_install_message:
336
+ post_install_message:
337
337
  rdoc_options: []
338
338
  require_paths:
339
339
  - lib
@@ -349,8 +349,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
349
  version: '0'
350
350
  requirements:
351
351
  - z3 library (4.8+)
352
- rubygems_version: 3.1.2
353
- signing_key:
352
+ rubygems_version: 3.0.3
353
+ signing_key:
354
354
  specification_version: 4
355
355
  summary: Z3 Constraint Solver
356
356
  test_files: []