z3 0.0.20160427 → 0.0.20161008
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/Rakefile +56 -0
- data/examples/bit_tricks +21 -38
- data/examples/circuit_problems +170 -0
- data/lib/z3/ast.rb +21 -3
- data/lib/z3/context.rb +9 -7
- data/lib/z3/exception.rb +1 -2
- data/lib/z3/expr/arith_expr.rb +29 -11
- data/lib/z3/expr/array_expr.rb +5 -0
- data/lib/z3/expr/bitvec_expr.rb +293 -13
- data/lib/z3/expr/bool_expr.rb +30 -6
- data/lib/z3/expr/expr.rb +155 -2
- data/lib/z3/expr/float_expr.rb +185 -0
- data/lib/z3/expr/int_expr.rb +20 -5
- data/lib/z3/expr/real_expr.rb +1 -3
- data/lib/z3/expr/rounding_mode_expr.rb +5 -0
- data/lib/z3/expr/set_expr.rb +66 -0
- data/lib/z3/func_decl.rb +5 -5
- data/lib/z3/goal.rb +64 -0
- data/lib/z3/interface.rb +21 -222
- data/lib/z3/low_level.rb +84 -58
- data/lib/z3/low_level_auto.rb +1509 -1563
- data/lib/z3/model.rb +39 -37
- data/lib/z3/printer.rb +54 -12
- data/lib/z3/probe.rb +69 -0
- data/lib/z3/solver.rb +20 -20
- data/lib/z3/sort/array_sort.rb +24 -0
- data/lib/z3/sort/bitvec_sort.rb +1 -1
- data/lib/z3/sort/float_sort.rb +92 -0
- data/lib/z3/sort/rounding_mode_sort.rb +41 -0
- data/lib/z3/sort/set_sort.rb +31 -0
- data/lib/z3/sort/sort.rb +39 -5
- data/lib/z3/tactic.rb +69 -0
- data/lib/z3/very_low_level.rb +33 -29
- data/lib/z3/very_low_level_auto.rb +505 -517
- data/lib/z3.rb +13 -0
- data/spec/array_expr_spec.rb +18 -0
- data/spec/array_sort_spec.rb +11 -0
- data/spec/bitvec_expr_spec.rb +196 -44
- data/spec/bitvec_sort_spec.rb +29 -27
- data/spec/bool_expr_spec.rb +57 -55
- data/spec/bool_sort_spec.rb +17 -15
- data/spec/coverage_helper.rb +11 -0
- data/spec/expr_spec.rb +151 -147
- data/spec/float_expr_spec.rb +167 -0
- data/spec/float_sort_spec.rb +44 -0
- data/spec/goal_spec.rb +17 -0
- data/spec/int_expr_spec.rb +76 -63
- data/spec/int_sort_spec.rb +16 -14
- data/spec/integration/algebra_problems_spec.rb +4 -4
- data/spec/integration/cicruit_problem_spec.rb +23 -0
- data/spec/integration/geometry_problem_spec.rb +4 -4
- data/spec/integration/kinematics_problems_spec.rb +3 -3
- data/spec/model_spec.rb +39 -37
- data/spec/printer_spec.rb +49 -18
- data/spec/probe_spec.rb +17 -0
- data/spec/real_expr_spec.rb +59 -51
- data/spec/real_sort_spec.rb +22 -20
- data/spec/rounding_mode_expr_spec.rb +16 -0
- data/spec/rounding_mode_sort_spec.rb +13 -0
- data/spec/set_expr_spec.rb +61 -0
- data/spec/set_sort_spec.rb +27 -0
- data/spec/solver_spec.rb +37 -27
- data/spec/sort_spec.rb +38 -36
- data/spec/spec_helper.rb +59 -2
- data/spec/tactic_spec.rb +9 -0
- metadata +44 -4
data/lib/z3/very_low_level.rb
CHANGED
@@ -2,39 +2,43 @@
|
|
2
2
|
|
3
3
|
require 'ffi'
|
4
4
|
|
5
|
-
module Z3
|
6
|
-
|
7
|
-
|
5
|
+
module Z3
|
6
|
+
module VeryLowLevel
|
7
|
+
extend FFI::Library
|
8
|
+
ffi_lib "z3"
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
class << self
|
11
|
+
# Aliases defined just to make APIs below look nicer
|
12
|
+
def attach_function(name, arg_types, return_type)
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
arg_types = arg_types.map{|t| map_type(t)}
|
15
|
+
return_type = map_type(return_type)
|
16
|
+
super(name, arg_types, return_type)
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
def map_type(t)
|
20
|
+
if t.to_s =~ /\A(.*)_pointer\z/
|
21
|
+
:pointer
|
22
|
+
else
|
23
|
+
t
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
|
-
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
28
|
+
### Manually added functions gen_api can't handle [yet]
|
29
|
+
# callback :error_handler, [:ctx_pointer, :int], :void
|
30
|
+
callback :error_handler, [:pointer, :int], :void
|
31
|
+
attach_function :Z3_get_version, [:pointer, :pointer, :pointer, :pointer], :void
|
32
|
+
attach_function :Z3_set_error_handler, [:ctx_pointer, :error_handler], :void
|
33
|
+
attach_function :Z3_mk_context, [:config_pointer], :ctx_pointer
|
34
|
+
attach_function :Z3_model_eval, [:ctx_pointer, :model_pointer, :ast_pointer, :bool, :pointer], :int
|
35
|
+
attach_function :Z3_mk_and, [:ctx_pointer, :int, :pointer], :ast_pointer
|
36
|
+
attach_function :Z3_mk_or, [:ctx_pointer, :int, :pointer], :ast_pointer
|
37
|
+
attach_function :Z3_mk_add, [:ctx_pointer, :int, :pointer], :ast_pointer
|
38
|
+
attach_function :Z3_mk_sub, [:ctx_pointer, :int, :pointer], :ast_pointer
|
39
|
+
attach_function :Z3_mk_mul, [:ctx_pointer, :int, :pointer], :ast_pointer
|
40
|
+
attach_function :Z3_mk_set_union, [:ctx_pointer, :int, :pointer], :ast_pointer
|
41
|
+
attach_function :Z3_mk_set_intersect, [:ctx_pointer, :int, :pointer], :ast_pointer
|
42
|
+
attach_function :Z3_mk_distinct, [:ctx_pointer, :int, :pointer], :ast_pointer
|
43
|
+
end
|
40
44
|
end
|