Example #1
0
 void throw_unknown_parameter(symbol const & param_name, param_descrs const& d, symbol const & mod_name) {
     if (mod_name == symbol::null) {
         char const * new_name = get_new_param_name(param_name);
         if (new_name) {
             std::stringstream strm;
             strm << "the parameter '" << param_name
                  << "', invoke 'z3 -p' to obtain the new parameter list, and 'z3 -pp:" << new_name
                  << "' for the full description of the parameter";
             throw exception(strm.str());
         }
         else if (is_old_param_name(param_name)) {
             std::stringstream strm;
             strm << "unknown parameter '" << param_name 
                  << "', this is an old parameter name, invoke 'z3 -p' to obtain the new parameter list";
             throw default_exception(strm.str());
         }
         else {
             std::stringstream strm;
             strm << "unknown parameter '" << param_name << "'\n";    
             strm << "Legal parameters are:\n";
             d.display(strm, 2, false, false);
             throw default_exception(strm.str());
         }
     }
     else {
         std::stringstream strm;
         strm << "unknown parameter '" << param_name << "' ";
         strm << "at module '" << mod_name << "'\n";
         strm << "Legal parameters are:\n";
         d.display(strm, 2, false, false);
         throw default_exception(strm.str());
     }
 }
Example #2
0
 virtual void init_pdescrs(cmd_context & ctx, param_descrs & p) {
     th_rewriter::get_param_descrs(p);
     insert_timeout(p);
     p.insert("print", CPK_BOOL, "(default: true)  print the simplified term.");
     p.insert("print_proofs", CPK_BOOL, "(default: false) print a proof showing the original term is equal to the resultant one.");
     p.insert("print_statistics", CPK_BOOL, "(default: false) print statistics.");
 }
Example #3
0
 virtual void init_pdescrs(cmd_context & ctx, param_descrs & p) {
     m_dl_ctx->get_dl_context().collect_params(p);
     insert_timeout(p);
     p.insert(":print-answer", CPK_BOOL, "(default: false) print answer instance(s) to query.");
     p.insert(":print-certificate", CPK_BOOL, "(default: false) print certificate for reachability or non-reachability.");
     p.insert(":print-statistics",  CPK_BOOL, "(default: false) print statistics.");
 }
Example #4
0
 static void collect_param_descrs(param_descrs & d) {
   d.insert("max_memory", CPK_UINT, "maximum amount of memory in megabytes", "4294967295","nnf");
   d.insert("sk_hack", CPK_BOOL, "hack for VCC", "false","nnf");
   d.insert("mode", CPK_SYMBOL, "NNF translation mode: skolem (skolem normal form), quantifiers (skolem normal form + quantifiers in NNF), full", "skolem","nnf");
   d.insert("ignore_labels", CPK_BOOL, "remove/ignore labels in the input formula, this option is ignored if proofs are enabled", "false","nnf");
   d.insert("skolemize", CPK_BOOL, "skolemize (existential force) quantifiers", "true","nnf");
 }
Example #5
0
 std::string get_default(param_descrs const & d, symbol const & p, symbol const & m) {
     if (!d.contains(p)) {
         throw_unknown_parameter(p, d, m);
     }
     char const * r = d.get_default(p);
     if (r == nullptr)
         return "default";
     return r;
 }
Example #6
0
void context_params::collect_param_descrs(param_descrs & d) {
    d.insert("timeout", CPK_UINT, "default timeout (in milliseconds) used for solvers", "4294967295");
    d.insert("well_sorted_check", CPK_BOOL, "type checker", "true");
    d.insert("type_check", CPK_BOOL, "type checker (alias for well_sorted_check)", "true");
    d.insert("auto_config", CPK_BOOL, "use heuristics to automatically select solver and configure it", "true");
    d.insert("model_validate", CPK_BOOL, "validate models produced by solvers", "false");
    d.insert("trace", CPK_BOOL, "trace generation for VCC", "false");
    d.insert("trace_file_name", CPK_STRING, "trace out file name (see option 'trace')", "z3.log");
    d.insert("debug_ref_count", CPK_BOOL, "debug support for AST reference counting", "false");
    d.insert("smtlib2_compliant", CPK_BOOL, "enable/disable SMT-LIB 2.0 compliance", "false");
    collect_solver_param_descrs(d);
}
Example #7
0
 void display_smt2(std::ostream & out, char const* module, param_descrs& descrs) const {
     svector<params::entry>::const_iterator it  = m_entries.begin();  
     svector<params::entry>::const_iterator end = m_entries.end();
     for (; it != end; ++it) {
         if (!descrs.contains(it->first)) continue;
         out << "(set-option :";
         out << module << ".";        
         out << it->first;
         switch (it->second.m_kind) {
         case CPK_BOOL:
             out << " " << (it->second.m_bool_value?"true":"false");
             break;
         case CPK_UINT:
             out << " " <<it->second.m_uint_value;
             break;
         case CPK_DOUBLE:
             out << " " << it->second.m_double_value;
             break;
         case CPK_NUMERAL:
             out << " " << *(it->second.m_rat_value);
             break;
         case CPK_SYMBOL:
             out << " " << symbol::mk_symbol_from_c_ptr(it->second.m_sym_value);
             break;
         case CPK_STRING:
             out << " " << it->second.m_str_value;
             break;
         default:
             UNREACHABLE();
             break;
         }
         out << ")\n";
     }
 }
Example #8
0
    void validate_type(symbol const& name, char const* value, param_descrs const& d) {
        param_kind k = d.get_kind(name);
        std::stringstream strm;
        char const* _value = value;
        switch (k) {
        case CPK_UINT:
            for (; *value; ++value) {
                if (!('0' <= *value && *value <= '9')) {
                    strm << "Expected values for parameter " << name 
                         << " is an unsigned integer. It was given argument '" << _value << "'";
                    throw default_exception(strm.str());                    
                }
            }
            break;
        case CPK_DOUBLE:
            for (; *value; ++value) {
                if (!('0' <= *value && *value <= '9') && *value != '.' && *value != '-' && *value != '/') {
                    strm << "Expected values for parameter " << name 
                         << " is a double. It was given argument '" << _value << "'";
                    throw default_exception(strm.str());                                        
                }
            }
            break;

        case CPK_BOOL:
            if (strcmp(value, "true") != 0 && strcmp(value, "false") != 0) {
                strm << "Expected values for parameter " << name 
                     << " are 'true' or 'false'. It was given argument '" << value << "'";
                throw default_exception(strm.str());
            }
            break;
        default:
            break;
        }
    }
Example #9
0
 void set(param_descrs const & d, symbol const & param_name, char const * value, symbol const & mod_name) {
     param_kind k = d.get_kind(param_name);
     params_ref & ps = get_params(mod_name);
     if (k == CPK_INVALID) {
         throw_unknown_parameter(param_name, d, mod_name);
     }
     else if (k == CPK_UINT) {
         long val = strtol(value, nullptr, 10);
         ps.set_uint(param_name, static_cast<unsigned>(val));
     }
     else if (k == CPK_DOUBLE) {
         char * aux;
         double val = strtod(value, &aux);
         ps.set_double(param_name, val);
     }
     else if (k == CPK_BOOL) {
         if (strcmp(value, "true") == 0) {
             ps.set_bool(param_name, true);
         }
         else if (strcmp(value, "false") == 0) {
             ps.set_bool(param_name, false);
         }
         else {
             std::stringstream strm;
             strm << "invalid value '" << value << "' for Boolean parameter '" << param_name << "'";                
             if (mod_name == symbol::null) {
                 strm << " at module '" << mod_name << "'";
             }
             throw default_exception(strm.str());
         }
     }
     else if (k == CPK_SYMBOL) {
         ps.set_sym(param_name, symbol(value));
     }
     else if (k == CPK_STRING) {
         // There is no guarantee that (external) callers will not delete value after invoking gparams::set.
         // I see two solutions:
         //    1) Modify params_ref to create a copy of set_str parameters.
         //       This solution is not nice since we create copies and move the params_ref around.
         //       We would have to keep copying the strings.
         //       Moreover, when we use params_ref internally, the value is usually a static value. 
         //       So, we would be paying this price for nothing.
         //    2) "Copy" value by transforming it into a symbol. 
         //       I'm using this solution for now.
         ps.set_str(param_name, symbol(value).bare_str());
     }
     else {
         std::stringstream strm;
         strm << "unsupported parameter type '" << param_name << "'";            
         if (mod_name == symbol::null) {
             strm << " at module '" << mod_name << "'";            
         }
         throw exception(strm.str());
     }
 }
Example #10
0
 static void collect_param_descrs(param_descrs & d) {
     d.insert("max_memory", CPK_UINT, "maximum amount of memory in megabytes", "4294967295","rewriter");
     d.insert("max_steps", CPK_UINT, "maximum number of steps", "4294967295","rewriter");
     d.insert("flat", CPK_BOOL, "create nary applications for and,or,+,*,bvadd,bvmul,bvand,bvor,bvxor", "true","rewriter");
     d.insert("push_ite_arith", CPK_BOOL, "push if-then-else over arithmetic terms.", "false","rewriter");
     d.insert("push_ite_bv", CPK_BOOL, "push if-then-else over bit-vector terms.", "false","rewriter");
     d.insert("pull_cheap_ite", CPK_BOOL, "pull if-then-else terms when cheap.", "false","rewriter");
     d.insert("cache_all", CPK_BOOL, "cache all intermediate results.", "false","rewriter");
 }
Example #11
0
 void validate(param_descrs const & p) const {
     svector<params::entry>::const_iterator it  = m_entries.begin();  
     svector<params::entry>::const_iterator end = m_entries.end();
     for (; it != end; ++it) {                                
         param_kind expected = p.get_kind(it->first);
         if (expected == CPK_INVALID)
             throw default_exception("unknown parameter '%s'", it->first.str().c_str());
         if (it->second.m_kind != expected) 
             throw default_exception("parameter kind mismatch '%s'", it->first.str().c_str());
     }
 }
Example #12
0
 void validate(param_descrs const & p) {
     svector<params::entry>::iterator it  = m_entries.begin();  
     svector<params::entry>::iterator end = m_entries.end();
     symbol suffix, prefix;
     for (; it != end; ++it) {                                
         param_kind expected = p.get_kind_in_module(it->first);
         if (expected == CPK_INVALID) {
             std::stringstream strm;
             strm << "unknown parameter '" << it->first.str() << "'\n";    
             strm << "Legal parameters are:\n";
             p.display(strm, 2, false, false);
             throw default_exception(strm.str());
         }
         if (it->second.m_kind != expected && 
             !(it->second.m_kind == CPK_UINT && expected == CPK_NUMERAL)) {
             std::stringstream strm;
             strm << "Parameter " << it->first.str() << " was given argument of type ";
             strm << it->second.m_kind << ", expected " << expected;                
             throw default_exception(strm.str());
         }
     }
 }
Example #13
0
void insert_timeout(param_descrs & r) {
    r.insert(":timeout", CPK_UINT, "(default: infty) timeout in milliseconds.");
}
Example #14
0
void insert_produce_proofs(param_descrs & r) {
    r.insert(":produce-proofs", CPK_BOOL, "(default: false) proof generation.");
}
Example #15
0
void insert_produce_models(param_descrs & r) {
    r.insert(":produce-models", CPK_BOOL, "(default: false) model generation.");
}
Example #16
0
void insert_max_steps(param_descrs & r) {
    r.insert(":max-steps", CPK_UINT, "(default: infty) maximum number of steps.");
}
Example #17
0
void insert_max_memory(param_descrs & r) {
    r.insert(":max-memory", CPK_UINT, "(default: infty) maximum amount of memory in megabytes.");
}
Example #18
0
void bound_propagator::get_param_descrs(param_descrs & r) {
    r.insert("bound_max_refinements", CPK_UINT, "(default: 16) maximum number of bound refinements (per round) for unbounded variables.");
    r.insert("bound_threshold", CPK_DOUBLE, "(default: 0.05) bound propagation improvement threshold ratio.");
}
Example #19
0
 virtual void init_pdescrs(cmd_context & ctx, param_descrs & p) {
     p.insert("weight", CPK_NUMERAL, "(default: 1) penalty of not satisfying constraint.");
     p.insert("id", CPK_SYMBOL, "(default: null) partition identifier for soft constraints.");
 }
 static void collect_param_descrs(param_descrs & d) {
   d.insert("asymm_branch", CPK_BOOL, "asymmetric branching", "true","sat");
   d.insert("asymm_branch.rounds", CPK_UINT, "maximum number of rounds of asymmetric branching", "32","sat");
   d.insert("asymm_branch.limit", CPK_UINT, "approx. maximum number of literals visited during asymmetric branching", "100000000","sat");
 }
Example #21
0
 static void collect_param_descrs(param_descrs & d) {
   d.insert("partial", CPK_BOOL, "enable/disable partial function interpretations", "false","model");
   d.insert("v1", CPK_BOOL, "use Z3 version 1.x pretty printer", "false","model");
   d.insert("v2", CPK_BOOL, "use Z3 version 2.x (x <= 16) pretty printer", "false","model");
   d.insert("compact", CPK_BOOL, "try to compact function graph (i.e., function interpretations that are lookup tables)", "false","model");
 }
Example #22
0
 void register_global(param_descrs & d) {
     // Don't need synchronization here, this method
     // is invoked from check_registered that is already protected.
     m_param_descrs.copy(d);
 }
Example #23
0
 void init_pdescrs(cmd_context & ctx, param_descrs & p) override {
     insert_timeout(p);
     p.insert("print", CPK_BOOL, "(default: true)  print the simplified term.");
     p.insert("print_statistics", CPK_BOOL, "(default: false) print statistics.");
 }
 static void collect_param_descrs(param_descrs & d) {
   d.insert("elim_blocked_clauses", CPK_BOOL, "eliminate blocked clauses", "false","sat");
   d.insert("elim_blocked_clauses_at", CPK_UINT, "eliminate blocked clauses only once at the given simplification round", "2","sat");
   d.insert("blocked_clause_limit", CPK_UINT, "maximum number of literals visited during blocked clause elimination", "100000000","sat");
   d.insert("resolution", CPK_BOOL, "eliminate boolean variables using resolution", "true","sat");
   d.insert("resolution.limit", CPK_UINT, "approx. maximum number of literals visited during variable elimination", "500000000","sat");
   d.insert("resolution.occ_cutoff", CPK_UINT, "first cutoff (on number of positive/negative occurrences) for Boolean variable elimination", "10","sat");
   d.insert("resolution.occ_cutoff_range1", CPK_UINT, "second cutoff (number of positive/negative occurrences) for Boolean variable elimination, for problems containing less than res_cls_cutoff1 clauses", "8","sat");
   d.insert("resolution.occ_cutoff_range2", CPK_UINT, "second cutoff (number of positive/negative occurrences) for Boolean variable elimination, for problems containing more than res_cls_cutoff1 and less than res_cls_cutoff2", "5","sat");
   d.insert("resolution.occ_cutoff_range3", CPK_UINT, "second cutoff (number of positive/negative occurrences) for Boolean variable elimination, for problems containing more than res_cls_cutoff2", "3","sat");
   d.insert("resolution.lit_cutoff_range1", CPK_UINT, "second cutoff (total number of literals) for Boolean variable elimination, for problems containing less than res_cls_cutoff1 clauses", "700","sat");
   d.insert("resolution.lit_cutoff_range2", CPK_UINT, "second cutoff (total number of literals) for Boolean variable elimination, for problems containing more than res_cls_cutoff1 and less than res_cls_cutoff2", "400","sat");
   d.insert("resolution.lit_cutoff_range3", CPK_UINT, "second cutoff (total number of literals) for Boolean variable elimination, for problems containing more than res_cls_cutoff2", "300","sat");
   d.insert("resolution.cls_cutoff1", CPK_UINT, "limit1 - total number of problems clauses for the second cutoff of Boolean variable elimination", "100000000","sat");
   d.insert("resolution.cls_cutoff2", CPK_UINT, "limit2 - total number of problems clauses for the second cutoff of Boolean variable elimination", "700000000","sat");
   d.insert("elim_vars", CPK_BOOL, "enable variable elimination during simplification", "true","sat");
   d.insert("subsumption", CPK_BOOL, "eliminate subsumed clauses", "true","sat");
   d.insert("subsumption.limit", CPK_UINT, "approx. maximum number of literals visited during subsumption (and subsumption resolution)", "100000000","sat");
 }
Example #25
0
void context_params::collect_solver_param_descrs(param_descrs & d) {
    d.insert("proof", CPK_BOOL, "proof generation, it must be enabled when the Z3 context is created", "false");
    d.insert("model", CPK_BOOL, "model generation for solvers, this parameter can be overwritten when creating a solver", "true");
    d.insert("unsat_core", CPK_BOOL, "unsat-core generation for solvers, this parameter can be overwritten when creating a solver, not every solver in Z3 supports unsat core generation", "false");
}
Example #26
0
 virtual void collect_param_descrs(param_descrs & r) { 
     insert_max_memory(r);
     r.insert("aig_per_assertion", CPK_BOOL, "(default: true) process one assertion at a time.");
 }