3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-04 06:15:46 +00:00

integrate lambda expressions

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-06-26 07:23:04 -07:00
parent bf4edef761
commit 520ce9a5ee
139 changed files with 2243 additions and 1506 deletions

View file

@ -482,6 +482,10 @@ typedef enum
T1: (~ p q)
[quant-intro T1]: (~ (forall (x) p) (forall (x) q))
- Z3_OP_PR_BIND: Given a proof p, produces a proof of lambda x . p, where x are free variables in p.
T1: f
[proof-bind T1] forall (x) f
- Z3_OP_PR_DISTRIBUTIVITY: Distributivity proof object.
Given that f (= or) distributes over g (= and), produces a proof for
@ -1109,6 +1113,7 @@ typedef enum {
Z3_OP_PR_TRANSITIVITY_STAR,
Z3_OP_PR_MONOTONICITY,
Z3_OP_PR_QUANT_INTRO,
Z3_OP_PR_BIND,
Z3_OP_PR_DISTRIBUTIVITY,
Z3_OP_PR_AND_ELIM,
Z3_OP_PR_NOT_OR_ELIM,
@ -1857,7 +1862,6 @@ extern "C" {
*/
Z3_sort Z3_API Z3_mk_array_sort_n(Z3_context c, unsigned n, Z3_sort const * domain, Z3_sort range);
/**
\brief Create a tuple type.
@ -2946,6 +2950,8 @@ extern "C" {
*/
Z3_ast Z3_API Z3_mk_select(Z3_context c, Z3_ast a, Z3_ast i);
/**
\brief n-ary Array read.
The argument \c a is the array and \c idxs are the indices of the array that gets read.
@ -2955,6 +2961,7 @@ extern "C" {
*/
Z3_ast Z3_API Z3_mk_select_n(Z3_context c, Z3_ast a, unsigned n, Z3_ast const* idxs);
/**
\brief Array update.
@ -2973,6 +2980,7 @@ extern "C" {
*/
Z3_ast Z3_API Z3_mk_store(Z3_context c, Z3_ast a, Z3_ast i, Z3_ast v);
/**
\brief n-ary Array update.
@ -3763,6 +3771,54 @@ extern "C" {
Z3_ast body
);
/**
\brief Create a lambda expression. It taks an expression \c body that contains bound variables
of the same sorts as the sorts listed in the array \c sorts. The bound variables are de-Bruijn indices created
using #Z3_mk_bound. The array \c decl_names contains the names that the quantified formula uses for the
bound variables. Z3 applies the convention that the last element in the \c decl_names and \c sorts array
refers to the variable with index 0, the second to last element of \c decl_names and \c sorts refers
to the variable with index 1, etc.
The sort of the resulting expression is \c (Array sorts range) where \c range is the sort of \c body.
For example, if the lambda binds two variables of sort \c Int and \c Bool, and the \c body has sort \c Real,
the sort of the expression is \c (Array Int Bool Real).
\param c logical context
\param num_decls number of variables to be bound.
\param sorts the sorts of the bound variables.
\param decl_names names of the bound variables
\param body the body of the lambda expression.
\sa Z3_mk_bound
\sa Z3_mk_forall
\sa Z3_mk_lambda_const
def_API('Z3_mk_lambda', AST, (_in(CONTEXT), _in(UINT), _in_array(1, SORT), _in_array(1, SYMBOL), _in(AST)))
*/
Z3_ast Z3_API Z3_mk_lambda(Z3_context c,
unsigned num_decls, Z3_sort const sorts[],
Z3_symbol const decl_names[],
Z3_ast body);
/**
\brief Create a lambda expression using a list of constants that form the set
of bound variables
\param c logical context.
\param num_bound number of constants to be abstracted into bound variables.
\param bound array of constants to be abstracted into bound variables.
\param body the body of the lambda expression.
\sa Z3_mk_bound
\sa Z3_mk_forall
\sa Z3_mk_lambda
def_API('Z3_mk_lambda_const', AST, (_in(CONTEXT), _in(UINT), _in_array(1, APP), _in(AST)))
*/
Z3_ast Z3_API Z3_mk_lambda_const(Z3_context c,
unsigned num_bound, Z3_app const bound[],
Z3_ast body);
/*@}*/
/** @name Accessors */
@ -4529,14 +4585,29 @@ extern "C" {
unsigned Z3_API Z3_get_index_value(Z3_context c, Z3_ast a);
/**
\brief Determine if quantifier is universal.
\pre Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST
\brief Determine if an ast is a universal quantifier.
def_API('Z3_is_quantifier_forall', BOOL, (_in(CONTEXT), _in(AST)))
*/
Z3_bool Z3_API Z3_is_quantifier_forall(Z3_context c, Z3_ast a);
/**
\brief Determine if ast is an existential quantifier.
def_API('Z3_is_quantifier_exists', BOOL, (_in(CONTEXT), _in(AST)))
*/
Z3_bool Z3_API Z3_is_quantifier_exists(Z3_context c, Z3_ast a);
/**
\brief Determine if ast is a lambda expresion.
\pre Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST
def_API('Z3_is_lambda', BOOL, (_in(CONTEXT), _in(AST)))
*/
Z3_bool Z3_API Z3_is_lambda(Z3_context c, Z3_ast a);
/**
\brief Obtain weight of quantifier.