z3 0.0.20211213 → 0.0.20220630
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/z3/expr/bitvec_expr.rb +47 -2
- data/lib/z3/optimize.rb +0 -1
- data/lib/z3/very_low_level.rb +1 -1
- data/spec/bitvec_expr_spec.rb +13 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9289c94f0a177c8e59d2c18c65775344414bb3558151ac58fc02e932b3a7eb1
|
4
|
+
data.tar.gz: 3171e750dc3a36d1534ffc0c069274ff8bc7bc4d59d15e6792add5c4ab5f90b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d19511280987279176db440a5c5f3764d9029b49c74185c32cbf3dd01e6f02bcefa92b5800b24d4e872f052cb40a8daddf756783c81f3fdb63055d1be950b119
|
7
|
+
data.tar.gz: '09eedf827d3dfae3c56fd6d1c165160cdb5e3aeab0e2faae429dd81da91b7eaafd6640a6f28ed2a1b45e8a3a3c3e12a03d38327e86ac497b69e974e5f431cee6'
|
data/lib/z3/expr/bitvec_expr.rb
CHANGED
@@ -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|
|
data/lib/z3/optimize.rb
CHANGED
data/lib/z3/very_low_level.rb
CHANGED
data/spec/bitvec_expr_spec.rb
CHANGED
@@ -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
|
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.
|
4
|
+
version: 0.0.20220630
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Wegrzanowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -331,7 +331,8 @@ files:
|
|
331
331
|
homepage: https://github.com/taw/z3
|
332
332
|
licenses:
|
333
333
|
- MIT
|
334
|
-
metadata:
|
334
|
+
metadata:
|
335
|
+
msys2_mingw_dependencies: z3
|
335
336
|
post_install_message:
|
336
337
|
rdoc_options: []
|
337
338
|
require_paths:
|
@@ -348,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
348
349
|
version: '0'
|
349
350
|
requirements:
|
350
351
|
- z3 library (4.8+)
|
351
|
-
rubygems_version: 3.
|
352
|
+
rubygems_version: 3.3.7
|
352
353
|
signing_key:
|
353
354
|
specification_version: 4
|
354
355
|
summary: Z3 Constraint Solver
|