示例#1
0
 bool Z3Expr::operator == (const Z3Object& Other) const
 {
     auto AsZ3Expr = dynamic_cast<const Z3Expr*>(&Other);
     if (AsZ3Expr == nullptr) {
         return false;
     }
     if (Ctx == nullptr || AST == nullptr) {
         return (Ctx == AsZ3Expr->Ctx && AST == AsZ3Expr->AST);
     } else {
         return (Ctx == AsZ3Expr->Ctx && Z3_is_eq_ast(Ctx, AST, AsZ3Expr->AST));
     }
 }
示例#2
0
bool Z3Expr::operator == (const Z3Object& Other) const
{
    auto OtherPtr = Other.As<Z3Expr>();

    if (OtherPtr == nullptr) {
        return false;
    }
    if (Ctx != OtherPtr->Ctx) {
        return false;
    }
    if (Ctx == Z3Ctx::NullPtr) {
        return true;
    }

    return (Z3_is_eq_ast(*Ctx, AST, OtherPtr->AST));
}
示例#3
0
/**
   \brief Return the number of soft-constraints that were disable by the given model.
   A soft-constraint was disabled if the associated auxiliary variable was assigned to true.
*/
unsigned get_num_disabled_soft_constraints(Z3_context ctx, Z3_model m, unsigned num_soft_cnstrs, Z3_ast * aux_vars) 
{
    unsigned i;
    unsigned num_disabled = 0;
    Z3_ast t = Z3_mk_true(ctx);
    for (i = 0; i < num_soft_cnstrs; i++) {
        Z3_ast val;
        if (Z3_model_eval(ctx, m, aux_vars[i], 1, &val) == true) {
            // printf("%s", Z3_ast_to_string(ctx, aux_vars[i]));
            // printf(" -> %s\n", Z3_ast_to_string(ctx, val));
            if (Z3_is_eq_ast(ctx, val, t)) {
                num_disabled++;
            }
        }
    }
    return num_disabled;
}
示例#4
0
int find_core_assumption_index(Z3_context ctx, Z3_ast * assumptions, unsigned n, Z3_ast p){

  int i;

  for(i=0;i<n;i++){
    if ( Z3_is_eq_ast(ctx,assumptions[i],p) )
      return i;
  }
  
  fprintf(stderr,"BUG: find_core_assumption_index. \n");
  fprintf(stderr," %s not found\n",Z3_ast_to_string(ctx, p));
  for(i=0;i<n;i++){
    fprintf(stderr," %s | ",Z3_ast_to_string(ctx,assumptions[i]));
  }
  fprintf(stderr,"\n");
  exit(1);
}