z3 0.0.20160427 → 0.0.20161008

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