package smtlib-utils

  1. Overview
  2. Docs

Trivial AST for parsing

val pp_to_string : (Format.formatter -> 'a -> unit) -> 'a -> string
type var = string
type ty_var = string
type ty =
  1. | Ty_bool
  2. | Ty_real
  3. | Ty_bv of int
  4. | Ty_app of ty_var * ty list
  5. | Ty_arrow of ty list * ty

Polymorphic types

type typed_var = var * ty
type arith_op =
  1. | Leq
  2. | Lt
  3. | Geq
  4. | Gt
  5. | Add
  6. | Minus
  7. | Mult
  8. | Div
type bitvec_op =
  1. | BVUlt
  2. | BVSlt
  3. | BVNot
  4. | BVAnd
  5. | BVXor
  6. | BVShl
  7. | BVLsht
  8. | BVAshr
  9. | BVAdd
  10. | BVMul
  11. | BVURem
  12. | BVUDiv
  13. | Concat
  14. | Sign_extend of int
  15. | Extract of int * int
type term =
  1. | True
  2. | False
  3. | Const of string
  4. | Arith of arith_op * term list
  5. | Bitvec of bitvec_op * term list
  6. | App of string * term list
  7. | HO_app of term * term
  8. | Match of term * match_branch list
  9. | If of term * term * term
  10. | Let of (var * term) list * term
  11. | Is_a of string * term
  12. | Fun of typed_var * term
  13. | Eq of term * term
  14. | Imply of term * term
  15. | And of term list
  16. | Or of term list
  17. | Not of term
  18. | Distinct of term list
  19. | Cast of term * ty
  20. | Forall of (var * ty) list * term
  21. | Exists of (var * ty) list * term
  22. | Attr of term * (string * string) list

AST: S-expressions with locations

and match_branch =
  1. | Match_default of term
  2. | Match_case of string * var list * term
type cstor = {
  1. cstor_ty_vars : ty_var list;
  2. cstor_name : string;
  3. cstor_args : (string * ty) list;
}
type 'arg fun_decl = {
  1. fun_ty_vars : ty_var list;
  2. fun_name : string;
  3. fun_args : 'arg list;
  4. fun_ret : ty;
}
type fun_def = {
  1. fr_decl : typed_var fun_decl;
  2. fr_body : term;
}
type funs_rec_def = {
  1. fsr_decls : typed_var fun_decl list;
  2. fsr_bodies : term list;
}
type prop_literal = string * bool
type statement = {
  1. stmt : stmt;
  2. loc : Smtlib_utils__.Loc.t option;
}
and stmt =
  1. | Stmt_set_logic of string
  2. | Stmt_set_info of string * string
  3. | Stmt_set_option of string list
  4. | Stmt_decl_sort of string * int
  5. | Stmt_decl of ty fun_decl
  6. | Stmt_fun_def of fun_def
  7. | Stmt_fun_rec of fun_def
  8. | Stmt_funs_rec of funs_rec_def
  9. | Stmt_data of ((string * int) * cstor list) list
  10. | Stmt_assert of term
  11. | Stmt_get_assertions
  12. | Stmt_get_assignment
  13. | Stmt_get_info of string
  14. | Stmt_get_model
  15. | Stmt_get_option of string
  16. | Stmt_get_proof
  17. | Stmt_get_unsat_assumptions
  18. | Stmt_get_unsat_core
  19. | Stmt_get_value of term list
  20. | Stmt_check_sat
  21. | Stmt_check_sat_assuming of prop_literal list
  22. | Stmt_pop of int
  23. | Stmt_push of int
  24. | Stmt_reset
  25. | Stmt_reset_assertions
  26. | Stmt_exit

Errors

exception Parse_error of Smtlib_utils__.Loc.t option * string
val parse_error : ?loc:Smtlib_utils__.Loc.t -> string -> 'a
val parse_errorf : ?loc:Smtlib_utils__.Loc.t -> ('a, unit, string, 'b) format4 -> 'a

Constructors

val ty_bool : ty
val ty_bv : int -> ty
val ty_app : ty_var -> ty list -> ty
val ty_const : ty_var -> ty
val ty_real : ty
val ty_arrow_l : ty list -> ty -> ty
val ty_arrow : ty -> ty -> ty
val true_ : term
val false_ : term
val const : string -> term
val app : string -> term list -> term
val ho_app : term -> term -> term
val ho_app_l : term -> term list -> term
val match_ : term -> match_branch list -> term
val if_ : term -> term -> term -> term
val fun_ : typed_var -> term -> term
val fun_l : typed_var list -> term -> term
val let_ : (var * term) list -> term -> term
val eq : term -> term -> term
val imply : term -> term -> term
val is_a : string -> term -> term
val and_ : term list -> term
val or_ : term list -> term
val distinct : term list -> term
val cast : term -> ty:ty -> term
val forall : (var * ty) list -> term -> term
val exists : (var * ty) list -> term -> term
val attr : term -> (string * string) list -> term
val not_ : term -> term
val arith : arith_op -> term list -> term
val bitvec : bitvec_op -> term list -> term
val _mk : ?loc:Smtlib_utils__.Loc.t -> stmt -> statement
val mk_cstor : vars:ty_var list -> string -> (string * ty) list -> cstor
val mk_fun_decl : ty_vars:ty_var list -> string -> 'a list -> ty -> 'a fun_decl
val mk_fun_rec : ty_vars:ty_var list -> string -> typed_var list -> ty -> term -> fun_def
val decl_sort : ?loc:Smtlib_utils__.Loc.t -> string -> arity:int -> statement
val decl_fun : ?loc:Smtlib_utils__.Loc.t -> tyvars:ty_var list -> string -> ty list -> ty -> statement
val fun_def : ?loc:Smtlib_utils__.Loc.t -> fun_def -> statement
val fun_rec : ?loc:Smtlib_utils__.Loc.t -> fun_def -> statement
val funs_rec : ?loc:Smtlib_utils__.Loc.t -> typed_var fun_decl list -> term list -> statement
val data : ?loc:Smtlib_utils__.Loc.t -> ((string * int) * cstor list) list -> statement
val data_zip : ?loc:Smtlib_utils__.Loc.t -> (string * int) list -> cstor list list -> statement
val assert_ : ?loc:Smtlib_utils__.Loc.t -> term -> statement
val check_sat : ?loc:Smtlib_utils__.Loc.t -> unit -> statement
val check_sat_assuming : ?loc:Smtlib_utils__.Loc.t -> prop_literal list -> statement
val exit : ?loc:Smtlib_utils__.Loc.t -> unit -> statement
val set_logic : ?loc:Smtlib_utils__.Loc.t -> string -> statement
val set_info : ?loc:Smtlib_utils__.Loc.t -> string -> string -> statement
val get_info : ?loc:Smtlib_utils__.Loc.t -> string -> statement
val set_option : ?loc:Smtlib_utils__.Loc.t -> string list -> statement
val get_option : ?loc:Smtlib_utils__.Loc.t -> string -> statement
val push : ?loc:Smtlib_utils__.Loc.t -> int -> statement
val pop : ?loc:Smtlib_utils__.Loc.t -> int -> statement
val get_proof : ?loc:Smtlib_utils__.Loc.t -> unit -> statement
val get_model : ?loc:Smtlib_utils__.Loc.t -> unit -> statement
val get_assertions : ?loc:Smtlib_utils__.Loc.t -> unit -> statement
val get_assignment : ?loc:Smtlib_utils__.Loc.t -> unit -> statement
val get_value : ?loc:Smtlib_utils__.Loc.t -> term list -> statement
val get_unsat_core : ?loc:Smtlib_utils__.Loc.t -> unit -> statement
val get_unsat_assumptions : ?loc:Smtlib_utils__.Loc.t -> unit -> statement
val reset : ?loc:Smtlib_utils__.Loc.t -> unit -> statement
val reset_assertions : ?loc:Smtlib_utils__.Loc.t -> unit -> statement
val loc : statement -> Smtlib_utils__.Loc.t option
val view : statement -> stmt
val fpf : Format.formatter -> ('a, Format.formatter, unit) format -> 'a
val pp_list : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a list -> unit
val pp_str : Format.formatter -> string -> unit
val pp_tyvar : Format.formatter -> string -> unit
val pp_ty : Format.formatter -> ty -> unit
val str_of_arith : arith_op -> string
val str_of_bitvec : bitvec_op -> string
val pp_arith : Format.formatter -> arith_op -> unit
val pp_bitvec : Format.formatter -> bitvec_op -> unit
val _lvl_top : int
val pp_typed_var : Format.formatter -> typed_var -> unit
val pp_term : Format.formatter -> term -> unit
val pp_par : (Format.formatter -> 'a -> unit) -> Format.formatter -> (string list * 'a) -> unit
val pp_fun_decl : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a fun_decl -> unit
val pp_fr : Format.formatter -> fun_def -> unit
val pp_prop_lit : Format.formatter -> (string * bool) -> unit
val pp_stmt : Format.formatter -> statement -> unit
OCaml

Innovation. Community. Security.