Module SMTSolver
High-level methods for an SMT solver
- author
- Alain Mebsout, Christoph Sticksel, Daniel Larraz
Creating and finalizing a solver instance
val create_instance : ?timeout:int -> ?produce_assignments:bool -> ?produce_proofs:bool -> ?produce_cores:bool -> ?minimize_cores:bool -> ?produce_interpolants:bool -> TermLib.logic -> Flags.Smt.solver -> tCreate a new instance of an SMT solver of the given kind and with the given flags
val delete_instance : t -> unitDelete an instance of an SMT solver
val delete_instance_entries : unit -> unitDelete instance entries (should be called after forking, on child processes).
val id_of_instance : t -> intReturn the unique identifier of the solver instance
Declarations
val declare_fun : t -> UfSymbol.t -> unitDefine uninterpreted symbol
val define_fun : t -> UfSymbol.t -> Var.t list -> Term.t -> unitDefine uninterpreted symbol
Primitives
val assert_named_term : t -> Term.t -> unitName a term, convert a term to an SMT expression and assert
val assert_named_term_wr : t -> Term.t -> stringName a term, convert a term to an SMT expression and assert, and return the name
val push : ?n:int -> t -> unitPush a new scope to the context stack
val pop : ?n:int -> t -> unitPop one scope from the context stack
val check_sat : ?timeout:int -> t -> boolCheck satisfiability of the current context
The optional parameter
timeoutlimits the maximum runtime to the given number of milliseconds.
val get_var_values : t -> LustreExpr.expr LustreExpr.bound_or_fixed list StateVar.StateVarHashtbl.t -> Var.t list -> Model.tReturn a values of the terms in the current context if satisfiable
Higher-level functions
val check_sat_assuming : t -> (t -> 'a) -> (t -> 'a) -> Term.t list -> 'aChecks satisfiability of the current context assuming the given list of literals, and evaluate one of two continuation functions depending on the result
check_sat_assuming s t f lassumes each of the literals inlto be true, and checks satisfiablilty of the context of the SMT solver instances. If the solver returns satisfiable, the continuationtis evaluated, and if the solver returns unsatisfiable, the continuationfis evaluated.Important: If a solver does not support check-sat with assumptions, it will be simulated by checking satisfiability on a new context level with the literals asserted. This context is removed after the continuations have been evaluated, hence all operations performed in the continuations affecting the context will be undone upon return from this function. Do not rely on context-modifying operations in the continuations being persistent, and keep the continuations as short as possible. Moreover, any call to get_unsat_core_lits should be done INSIDE the continutation if_unsat, and NOT in AFTER the call to check_sat_assuming.
The list
lshould contain only positive Boolean constants, although this is not enforced. If the solver does not support thecheck-sat-assumingcommand it is simulated by asserting the literals on a new context.
val check_sat_and_get_term_values : t -> (t -> (Term.t * Term.t) list -> 'a) -> (t -> 'a) -> Term.t list -> 'aChecks satisfiability of the current context, and evaluate one of two continuation functions depending on the result
check_sat_and_get_term_values s t f lchecks satisfiablilty of the context of the SMT solver instances. If the solver returns satisfiable, the continuationtis evaluated with the values of the terms ofl, and if the solver returns unsatisfiable, the continuationfis evaluated.
val check_sat_assuming_and_get_term_values : t -> (t -> (Term.t * Term.t) list -> 'a) -> (t -> 'a) -> Term.t list -> Term.t list -> 'aCheck satisfiability under assumptions as with
check_sat_assuming, but if the solver returns satisfiable, the values of the terms in the current context are given to the continuationtas its second argument
val check_sat_assuming_ab : t -> (t -> 'a) -> (t -> 'b) -> Term.t list -> ('a, 'b) sat_or_unsatCheck satisfiability under assumptions as with
check_sat_assuming, but the two continuations can return different values that are wrappen in thesat_or_unsattype
val check_sat_assuming_tf : t -> Term.t list -> boolCheck satisfiability under assumptions as with
check_sat_assuming, but returntrueorfalsewithout continuations as arguments
val execute_custom_command : t -> string -> SMTExpr.custom_arg list -> int -> SolverResponse.custom_responseExecute the a custom command with the given arguments, and expect the given number of S-expressions as a result
val execute_custom_check_sat_command : string -> t -> SolverResponse.check_sat_responseExecute the a custom command in place of check-sat
Utility functions
val converter : t -> (module SMTExpr.Conv)val kind : t -> Flags.Smt.solverval trace_comment : t -> string -> unitOutput a comment into the trace