mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
ML API savegame
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
parent
d293b579f3
commit
eea13a087f
5 changed files with 107 additions and 114 deletions
|
@ -11,7 +11,6 @@ open Z3enums
|
|||
let null = Z3native.mk_null()
|
||||
let is_null o = (Z3native.is_null o)
|
||||
|
||||
|
||||
(* Internal types *)
|
||||
type z3_native_context = { m_n_ctx : Z3native.z3_context; m_n_obj_cnt: int; }
|
||||
type context = z3_native_context
|
||||
|
@ -21,7 +20,6 @@ type z3_native_object = {
|
|||
mutable m_n_obj : Z3native.ptr ;
|
||||
inc_ref : Z3native.z3_context -> Z3native.ptr -> unit;
|
||||
dec_ref : Z3native.z3_context -> Z3native.ptr -> unit }
|
||||
|
||||
|
||||
(** Internal stuff *)
|
||||
module Internal =
|
||||
|
@ -1455,11 +1453,11 @@ struct
|
|||
|
||||
let to_string ( x : expr ) = Z3native.get_numeral_string (Expr.gnc x) (Expr.gno x)
|
||||
|
||||
let mk_int_const ( ctx : context ) ( name : Symbol.symbol ) =
|
||||
let mk_const ( ctx : context ) ( name : Symbol.symbol ) =
|
||||
Expr.mk_const ctx name (mk_sort ctx)
|
||||
|
||||
let mk_int_const_s ( ctx : context ) ( name : string ) =
|
||||
mk_int_const ctx (Symbol.mk_string ctx name)
|
||||
let mk_const_s ( ctx : context ) ( name : string ) =
|
||||
mk_const ctx (Symbol.mk_string ctx name)
|
||||
|
||||
let mk_mod ( ctx : context ) ( t1 : expr ) ( t2 : expr ) =
|
||||
expr_of_ptr ctx (Z3native.mk_mod (context_gno ctx) (Expr.gno t1) (Expr.gno t2))
|
||||
|
@ -1467,10 +1465,10 @@ struct
|
|||
let mk_rem ( ctx : context ) ( t1 : expr ) ( t2 : expr ) =
|
||||
expr_of_ptr ctx (Z3native.mk_rem (context_gno ctx) (Expr.gno t1) (Expr.gno t2))
|
||||
|
||||
let mk_int_numeral_s ( ctx : context ) ( v : string ) =
|
||||
let mk_numeral_s ( ctx : context ) ( v : string ) =
|
||||
expr_of_ptr ctx (Z3native.mk_numeral (context_gno ctx) v (Sort.gno (mk_sort ctx)))
|
||||
|
||||
let mk_int_numeral_i ( ctx : context ) ( v : int ) =
|
||||
let mk_numeral_i ( ctx : context ) ( v : int ) =
|
||||
expr_of_ptr ctx (Z3native.mk_int (context_gno ctx) v (Sort.gno (mk_sort ctx)))
|
||||
|
||||
let mk_int2real ( ctx : context ) ( t : expr ) =
|
||||
|
@ -1496,11 +1494,11 @@ struct
|
|||
|
||||
let to_string ( x : expr ) = Z3native.get_numeral_string (Expr.gnc x) (Expr.gno x)
|
||||
|
||||
let mk_real_const ( ctx : context ) ( name : Symbol.symbol ) =
|
||||
let mk_const ( ctx : context ) ( name : Symbol.symbol ) =
|
||||
Expr.mk_const ctx name (mk_sort ctx)
|
||||
|
||||
let mk_real_const_s ( ctx : context ) ( name : string ) =
|
||||
mk_real_const ctx (Symbol.mk_string ctx name)
|
||||
let mk_const_s ( ctx : context ) ( name : string ) =
|
||||
mk_const ctx (Symbol.mk_string ctx name)
|
||||
|
||||
let mk_numeral_nd ( ctx : context ) ( num : int ) ( den : int) =
|
||||
if (den == 0) then
|
||||
|
|
|
@ -30,7 +30,6 @@ type context
|
|||
(** Create a context object *)
|
||||
val mk_context : (string * string) list -> context
|
||||
|
||||
|
||||
(** Interaction logging for Z3
|
||||
Note that this is a global, static log and if multiple Context
|
||||
objects are created, it logs the interaction with all of them. *)
|
||||
|
@ -1117,10 +1116,10 @@ sig
|
|||
end
|
||||
|
||||
(** Functions to manipulate arithmetic expressions *)
|
||||
module rec Arithmetic :
|
||||
module Arithmetic :
|
||||
sig
|
||||
(** Integer Arithmetic *)
|
||||
module rec Integer :
|
||||
module Integer :
|
||||
sig
|
||||
(** Create a new integer sort. *)
|
||||
val mk_sort : context -> Sort.sort
|
||||
|
@ -1132,10 +1131,10 @@ sig
|
|||
val to_string : Expr.expr -> string
|
||||
|
||||
(** Creates an integer constant. *)
|
||||
val mk_int_const : context -> Symbol.symbol -> Expr.expr
|
||||
val mk_const : context -> Symbol.symbol -> Expr.expr
|
||||
|
||||
(** Creates an integer constant. *)
|
||||
val mk_int_const_s : context -> string -> Expr.expr
|
||||
val mk_const_s : context -> string -> Expr.expr
|
||||
|
||||
(** Create an expression representing <c>t1 mod t2</c>.
|
||||
The arguments must have int type. *)
|
||||
|
@ -1146,11 +1145,11 @@ sig
|
|||
val mk_rem : context -> Expr.expr -> Expr.expr -> Expr.expr
|
||||
|
||||
(** Create an integer numeral. *)
|
||||
val mk_int_numeral_s : context -> string -> Expr.expr
|
||||
val mk_numeral_s : context -> string -> Expr.expr
|
||||
|
||||
(** Create an integer numeral.
|
||||
@return A Term with the given value and sort Integer *)
|
||||
val mk_int_numeral_i : context -> int -> Expr.expr
|
||||
val mk_numeral_i : context -> int -> Expr.expr
|
||||
|
||||
(** Coerce an integer to a real.
|
||||
|
||||
|
@ -1174,7 +1173,7 @@ sig
|
|||
end
|
||||
|
||||
(** Real Arithmetic *)
|
||||
and Real :
|
||||
module Real :
|
||||
sig
|
||||
(** Create a real sort. *)
|
||||
val mk_sort : context -> Sort.sort
|
||||
|
@ -1193,10 +1192,10 @@ sig
|
|||
val to_string : Expr.expr-> string
|
||||
|
||||
(** Creates a real constant. *)
|
||||
val mk_real_const : context -> Symbol.symbol -> Expr.expr
|
||||
val mk_const : context -> Symbol.symbol -> Expr.expr
|
||||
|
||||
(** Creates a real constant. *)
|
||||
val mk_real_const_s : context -> string -> Expr.expr
|
||||
val mk_const_s : context -> string -> Expr.expr
|
||||
|
||||
(** Create a real numeral from a fraction.
|
||||
@return A Term with rational value and sort Real
|
||||
|
@ -1222,7 +1221,7 @@ sig
|
|||
end
|
||||
|
||||
(** Algebraic Numbers *)
|
||||
and AlgebraicNumber :
|
||||
module AlgebraicNumber :
|
||||
sig
|
||||
(** Return a upper bound for a given real algebraic number.
|
||||
The interval isolating the number is smaller than 1/10^precision.
|
||||
|
@ -1339,7 +1338,7 @@ sig
|
|||
end
|
||||
|
||||
(** Functions to manipulate bit-vector expressions *)
|
||||
and BitVector :
|
||||
module BitVector :
|
||||
sig
|
||||
(** Create a new bit-vector sort. *)
|
||||
val mk_sort : context -> int -> Sort.sort
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(**
|
||||
\(**
|
||||
The Z3 ML/Ocaml Interface.
|
||||
|
||||
Copyright (C) 2012 Microsoft Corporation
|
||||
|
@ -11,7 +11,6 @@ open Z3enums
|
|||
let null = Z3native.mk_null()
|
||||
let is_null o = (Z3native.is_null o)
|
||||
|
||||
|
||||
(* Internal types *)
|
||||
type z3_native_context = { m_n_ctx : Z3native.z3_context; m_n_obj_cnt: int; }
|
||||
type context = z3_native_context
|
||||
|
@ -1679,12 +1678,12 @@ sig
|
|||
val mk_sort : context -> int_sort
|
||||
val get_int : int_num -> int
|
||||
val to_string : int_num -> string
|
||||
val mk_int_const : context -> Symbol.symbol -> int_expr
|
||||
val mk_int_const_s : context -> string -> int_expr
|
||||
val mk_const : context -> Symbol.symbol -> int_expr
|
||||
val mk_const_s : context -> string -> int_expr
|
||||
val mk_mod : context -> int_expr -> int_expr -> int_expr
|
||||
val mk_rem : context -> int_expr -> int_expr -> int_expr
|
||||
val mk_int_numeral_s : context -> string -> int_num
|
||||
val mk_int_numeral_i : context -> int -> int_num
|
||||
val mk_numeral_s : context -> string -> int_num
|
||||
val mk_numeral_i : context -> int -> int_num
|
||||
val mk_int2real : context -> int_expr -> Real.real_expr
|
||||
val mk_int2bv : context -> int -> int_expr -> BitVector.bitvec_expr
|
||||
end
|
||||
|
@ -1709,8 +1708,8 @@ sig
|
|||
val get_denominator : rat_num -> Integer.int_num
|
||||
val to_decimal_string : rat_num -> int -> string
|
||||
val to_string : rat_num -> string
|
||||
val mk_real_const : context -> Symbol.symbol -> real_expr
|
||||
val mk_real_const_s : context -> string -> real_expr
|
||||
val mk_const : context -> Symbol.symbol -> real_expr
|
||||
val mk_const_s : context -> string -> real_expr
|
||||
val mk_numeral_nd : context -> int -> int -> rat_num
|
||||
val mk_numeral_s : context -> string -> rat_num
|
||||
val mk_numeral_i : context -> int -> rat_num
|
||||
|
@ -1816,12 +1815,12 @@ end = struct
|
|||
val mk_sort : context -> int_sort
|
||||
val get_int : int_num -> int
|
||||
val to_string : int_num -> string
|
||||
val mk_int_const : context -> Symbol.symbol -> int_expr
|
||||
val mk_int_const_s : context -> string -> int_expr
|
||||
val mk_const : context -> Symbol.symbol -> int_expr
|
||||
val mk_const_s : context -> string -> int_expr
|
||||
val mk_mod : context -> int_expr -> int_expr -> int_expr
|
||||
val mk_rem : context -> int_expr -> int_expr -> int_expr
|
||||
val mk_int_numeral_s : context -> string -> int_num
|
||||
val mk_int_numeral_i : context -> int -> int_num
|
||||
val mk_numeral_s : context -> string -> int_num
|
||||
val mk_numeral_i : context -> int -> int_num
|
||||
val mk_int2real : context -> int_expr -> Real.real_expr
|
||||
val mk_int2bv : context -> int -> int_expr -> BitVector.bitvec_expr
|
||||
end = struct
|
||||
|
@ -1884,11 +1883,11 @@ end = struct
|
|||
|
||||
let to_string ( x : int_num ) = Z3native.get_numeral_string (ngnc x) (ngno x)
|
||||
|
||||
let mk_int_const ( ctx : context ) ( name : Symbol.symbol ) =
|
||||
let mk_const ( ctx : context ) ( name : Symbol.symbol ) =
|
||||
IntExpr(ArithExpr(Expr.mk_const ctx name (match (mk_sort ctx) with IntSort(ArithSort(s)) -> s)))
|
||||
|
||||
let mk_int_const_s ( ctx : context ) ( name : string ) =
|
||||
mk_int_const ctx (Symbol.mk_string ctx name)
|
||||
let mk_const_s ( ctx : context ) ( name : string ) =
|
||||
mk_const ctx (Symbol.mk_string ctx name)
|
||||
|
||||
let mk_mod ( ctx : context ) ( t1 : int_expr ) ( t2 : int_expr ) =
|
||||
int_expr_of_ptr ctx (Z3native.mk_mod (context_gno ctx) (egno t1) (egno t2))
|
||||
|
@ -1896,10 +1895,10 @@ end = struct
|
|||
let mk_rem ( ctx : context ) ( t1 : int_expr ) ( t2 : int_expr ) =
|
||||
int_expr_of_ptr ctx (Z3native.mk_rem (context_gno ctx) (egno t1) (egno t2))
|
||||
|
||||
let mk_int_numeral_s ( ctx : context ) ( v : string ) =
|
||||
let mk_numeral_s ( ctx : context ) ( v : string ) =
|
||||
int_num_of_ptr ctx (Z3native.mk_numeral (context_gno ctx) v (sgno (mk_sort ctx)))
|
||||
|
||||
let mk_int_numeral_i ( ctx : context ) ( v : int ) =
|
||||
let mk_numeral_i ( ctx : context ) ( v : int ) =
|
||||
int_num_of_ptr ctx (Z3native.mk_int (context_gno ctx) v (sgno (mk_sort ctx)))
|
||||
|
||||
let mk_int2real ( ctx : context ) ( t : int_expr ) =
|
||||
|
@ -1930,8 +1929,8 @@ end = struct
|
|||
val get_denominator : rat_num -> Integer.int_num
|
||||
val to_decimal_string : rat_num -> int -> string
|
||||
val to_string : rat_num -> string
|
||||
val mk_real_const : context -> Symbol.symbol -> real_expr
|
||||
val mk_real_const_s : context -> string -> real_expr
|
||||
val mk_const : context -> Symbol.symbol -> real_expr
|
||||
val mk_const_s : context -> string -> real_expr
|
||||
val mk_numeral_nd : context -> int -> int -> rat_num
|
||||
val mk_numeral_s : context -> string -> rat_num
|
||||
val mk_numeral_i : context -> int -> rat_num
|
||||
|
@ -2002,11 +2001,11 @@ end = struct
|
|||
|
||||
let to_string ( x : rat_num ) = Z3native.get_numeral_string (ngnc x) (ngno x)
|
||||
|
||||
let mk_real_const ( ctx : context ) ( name : Symbol.symbol ) =
|
||||
let mk_const ( ctx : context ) ( name : Symbol.symbol ) =
|
||||
RealExpr(ArithExpr(Expr.mk_const ctx name (match (mk_sort ctx) with RealSort(ArithSort(s)) -> s)))
|
||||
|
||||
let mk_real_const_s ( ctx : context ) ( name : string ) =
|
||||
mk_real_const ctx (Symbol.mk_string ctx name)
|
||||
let mk_const_s ( ctx : context ) ( name : string ) =
|
||||
mk_const ctx (Symbol.mk_string ctx name)
|
||||
|
||||
let mk_numeral_nd ( ctx : context ) ( num : int ) ( den : int) =
|
||||
if (den == 0) then
|
||||
|
|
|
@ -34,7 +34,6 @@ type context
|
|||
(** Create a context object *)
|
||||
val mk_context : (string * string) list -> context
|
||||
|
||||
|
||||
(** Interaction logging for Z3
|
||||
Note that this is a global, static log and if multiple Context
|
||||
objects are created, it logs the interaction with all of them. *)
|
||||
|
@ -1219,10 +1218,10 @@ sig
|
|||
val to_string : int_num -> string
|
||||
|
||||
(** Creates an integer constant. *)
|
||||
val mk_int_const : context -> Symbol.symbol -> int_expr
|
||||
val mk_const : context -> Symbol.symbol -> int_expr
|
||||
|
||||
(** Creates an integer constant. *)
|
||||
val mk_int_const_s : context -> string -> int_expr
|
||||
val mk_const_s : context -> string -> int_expr
|
||||
|
||||
(** Create an expression representing <c>t1 mod t2</c>.
|
||||
The arguments must have int type. *)
|
||||
|
@ -1233,11 +1232,11 @@ sig
|
|||
val mk_rem : context -> int_expr -> int_expr -> int_expr
|
||||
|
||||
(** Create an integer numeral. *)
|
||||
val mk_int_numeral_s : context -> string -> int_num
|
||||
val mk_numeral_s : context -> string -> int_num
|
||||
|
||||
(** Create an integer numeral.
|
||||
@return A Term with the given value and sort Integer *)
|
||||
val mk_int_numeral_i : context -> int -> int_num
|
||||
val mk_numeral_i : context -> int -> int_num
|
||||
|
||||
(** Coerce an integer to a real.
|
||||
|
||||
|
@ -1291,10 +1290,10 @@ sig
|
|||
val to_string : rat_num -> string
|
||||
|
||||
(** Creates a real constant. *)
|
||||
val mk_real_const : context -> Symbol.symbol -> real_expr
|
||||
val mk_const : context -> Symbol.symbol -> real_expr
|
||||
|
||||
(** Creates a real constant. *)
|
||||
val mk_real_const_s : context -> string -> real_expr
|
||||
val mk_const_s : context -> string -> real_expr
|
||||
|
||||
(** Create a real numeral from a fraction.
|
||||
@return A Term with rational value and sort Real
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue