mirror of
				https://github.com/Z3Prover/z3
				synced 2025-11-03 21:09:11 +00:00 
			
		
		
		
	
							parent
							
								
									cbf089e10d
								
							
						
					
					
						commit
						9ca5b3f304
					
				
					 14 changed files with 20 additions and 21 deletions
				
			
		| 
						 | 
					@ -362,7 +362,7 @@ namespace dd {
 | 
				
			||||||
    }   
 | 
					    }   
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    bool solver::canceled() {
 | 
					    bool solver::canceled() {
 | 
				
			||||||
        return m_limit.get_cancel_flag();
 | 
					        return m_limit.is_canceled();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    bool solver::done() {
 | 
					    bool solver::done() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,7 +78,7 @@ struct solver::imp {
 | 
				
			||||||
            r = m_nlsat->check(); 
 | 
					            r = m_nlsat->check(); 
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        catch (z3_exception&) {
 | 
					        catch (z3_exception&) {
 | 
				
			||||||
            if (m_limit.get_cancel_flag()) {
 | 
					            if (m_limit.is_canceled()) {
 | 
				
			||||||
                r = l_undef;
 | 
					                r = l_undef;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else {
 | 
					            else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1759,7 +1759,7 @@ namespace nlsat {
 | 
				
			||||||
            if (assigned_value(antecedent) == l_undef) {
 | 
					            if (assigned_value(antecedent) == l_undef) {
 | 
				
			||||||
                checkpoint();
 | 
					                checkpoint();
 | 
				
			||||||
                // antecedent must be false in the current arith interpretation
 | 
					                // antecedent must be false in the current arith interpretation
 | 
				
			||||||
                SASSERT(value(antecedent) == l_false || m_rlimit.get_cancel_flag());
 | 
					                SASSERT(value(antecedent) == l_false || m_rlimit.is_canceled());
 | 
				
			||||||
                if (!is_marked(b)) {
 | 
					                if (!is_marked(b)) {
 | 
				
			||||||
                    SASSERT(is_arith_atom(b) && max_var(b) < m_xk); // must be in a previous stage
 | 
					                    SASSERT(is_arith_atom(b) && max_var(b) < m_xk); // must be in a previous stage
 | 
				
			||||||
                    TRACE("nlsat_resolve", tout << "literal is unassigned, but it is false in arithmetic interpretation, adding it to lemma\n";); 
 | 
					                    TRACE("nlsat_resolve", tout << "literal is unassigned, but it is false in arithmetic interpretation, adding it to lemma\n";); 
 | 
				
			||||||
| 
						 | 
					@ -1837,10 +1837,10 @@ namespace nlsat {
 | 
				
			||||||
                for (unsigned i = 0; i < sz; i++) {
 | 
					                for (unsigned i = 0; i < sz; i++) {
 | 
				
			||||||
                    literal l = m_lazy_clause[i];
 | 
					                    literal l = m_lazy_clause[i];
 | 
				
			||||||
                    if (l.var() != b) {
 | 
					                    if (l.var() != b) {
 | 
				
			||||||
                        SASSERT(value(l) == l_false || m_rlimit.get_cancel_flag());
 | 
					                        SASSERT(value(l) == l_false || m_rlimit.is_canceled());
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    else {
 | 
					                    else {
 | 
				
			||||||
                        SASSERT(value(l) == l_true || m_rlimit.get_cancel_flag());
 | 
					                        SASSERT(value(l) == l_true || m_rlimit.is_canceled());
 | 
				
			||||||
                        SASSERT(!l.sign() || m_bvalues[b] == l_false);
 | 
					                        SASSERT(!l.sign() || m_bvalues[b] == l_false);
 | 
				
			||||||
                        SASSERT(l.sign()  || m_bvalues[b] == l_true);
 | 
					                        SASSERT(l.sign()  || m_bvalues[b] == l_true);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -161,7 +161,7 @@ namespace opt {
 | 
				
			||||||
                case l_true:
 | 
					                case l_true:
 | 
				
			||||||
                    if (!update_assignment())
 | 
					                    if (!update_assignment())
 | 
				
			||||||
                        return l_undef;
 | 
					                        return l_undef;
 | 
				
			||||||
                    SASSERT(soft.value == l_true || m.limit().get_cancel_flag());
 | 
					                    SASSERT(soft.value == l_true || m.limit().is_canceled());
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                case l_false:
 | 
					                case l_false:
 | 
				
			||||||
                    soft.set_value(l_false);
 | 
					                    soft.set_value(l_false);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,7 @@ namespace qe {
 | 
				
			||||||
            DEBUG_CODE(expr_ref val(m); 
 | 
					            DEBUG_CODE(expr_ref val(m); 
 | 
				
			||||||
                       eval(lit, val); 
 | 
					                       eval(lit, val); 
 | 
				
			||||||
                       CTRACE("qe", !m.is_true(val), tout << mk_pp(lit, m) << " := " << val << "\n";);
 | 
					                       CTRACE("qe", !m.is_true(val), tout << mk_pp(lit, m) << " := " << val << "\n";);
 | 
				
			||||||
                       SASSERT(m.limit().get_cancel_flag() || !m.is_false(val)););
 | 
					                       SASSERT(m.limit().is_canceled() || !m.is_false(val)););
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!m.inc()) 
 | 
					            if (!m.inc()) 
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -182,13 +182,13 @@ void asserted_formulas::get_assertions(ptr_vector<expr> & result) const {
 | 
				
			||||||
void asserted_formulas::push_scope() {
 | 
					void asserted_formulas::push_scope() {
 | 
				
			||||||
    reduce();
 | 
					    reduce();
 | 
				
			||||||
    commit();
 | 
					    commit();
 | 
				
			||||||
    SASSERT(inconsistent() || m_qhead == m_formulas.size() || m.limit().get_cancel_flag());
 | 
					    SASSERT(inconsistent() || m_qhead == m_formulas.size() || m.limit().is_canceled());
 | 
				
			||||||
    TRACE("asserted_formulas_scopes", tout << "before push: " << m_scopes.size() << "\n";);
 | 
					    TRACE("asserted_formulas_scopes", tout << "before push: " << m_scopes.size() << "\n";);
 | 
				
			||||||
    m_scoped_substitution.push();
 | 
					    m_scoped_substitution.push();
 | 
				
			||||||
    m_scopes.push_back(scope());
 | 
					    m_scopes.push_back(scope());
 | 
				
			||||||
    scope & s = m_scopes.back();
 | 
					    scope & s = m_scopes.back();
 | 
				
			||||||
    s.m_formulas_lim = m_formulas.size();
 | 
					    s.m_formulas_lim = m_formulas.size();
 | 
				
			||||||
    SASSERT(inconsistent() || s.m_formulas_lim == m_qhead || m.limit().get_cancel_flag());
 | 
					    SASSERT(inconsistent() || s.m_formulas_lim == m_qhead || m.limit().is_canceled());
 | 
				
			||||||
    s.m_inconsistent_old = m_inconsistent;
 | 
					    s.m_inconsistent_old = m_inconsistent;
 | 
				
			||||||
    m_defined_names.push();
 | 
					    m_defined_names.push();
 | 
				
			||||||
    m_elim_term_ite.push();
 | 
					    m_elim_term_ite.push();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -554,7 +554,7 @@ namespace smt {
 | 
				
			||||||
        catch (...) {
 | 
					        catch (...) {
 | 
				
			||||||
            // Restore trail size since procedure was interrupted in the middle.
 | 
					            // Restore trail size since procedure was interrupted in the middle.
 | 
				
			||||||
            // If the add_eq_trail remains on the trail stack, then Z3 may crash when the destructor is invoked.
 | 
					            // If the add_eq_trail remains on the trail stack, then Z3 may crash when the destructor is invoked.
 | 
				
			||||||
            TRACE("add_eq", tout << "add_eq interrupted. This is unsafe " << m.limit().get_cancel_flag() << "\n";);
 | 
					            TRACE("add_eq", tout << "add_eq interrupted. This is unsafe " << m.limit().is_canceled() << "\n";);
 | 
				
			||||||
            m_trail_stack.shrink(old_trail_size);
 | 
					            m_trail_stack.shrink(old_trail_size);
 | 
				
			||||||
            throw;
 | 
					            throw;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -264,7 +264,7 @@ namespace smt {
 | 
				
			||||||
    bool context::check_th_diseq_propagation() const {
 | 
					    bool context::check_th_diseq_propagation() const {
 | 
				
			||||||
        TRACE("check_th_diseq_propagation", tout << "m_propagated_th_diseqs.size() " << m_propagated_th_diseqs.size() << "\n";);
 | 
					        TRACE("check_th_diseq_propagation", tout << "m_propagated_th_diseqs.size() " << m_propagated_th_diseqs.size() << "\n";);
 | 
				
			||||||
        int num = get_num_bool_vars();
 | 
					        int num = get_num_bool_vars();
 | 
				
			||||||
        if (inconsistent() || get_manager().limit().get_cancel_flag()) { 
 | 
					        if (inconsistent() || get_manager().limit().is_canceled()) {
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        for (bool_var v = 0; v < num; v++) {
 | 
					        for (bool_var v = 0; v < num; v++) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -191,7 +191,7 @@ namespace smt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    template<typename Ext>
 | 
					    template<typename Ext>
 | 
				
			||||||
    bool theory_arith<Ext>::satisfy_bounds() const {
 | 
					    bool theory_arith<Ext>::satisfy_bounds() const {
 | 
				
			||||||
        if (get_manager().limit().get_cancel_flag())
 | 
					        if (get_manager().limit().is_canceled())
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        int num = get_num_vars();
 | 
					        int num = get_num_vars();
 | 
				
			||||||
        for (theory_var v = 0; v < num; v++) {
 | 
					        for (theory_var v = 0; v < num; v++) {
 | 
				
			||||||
| 
						 | 
					@ -217,7 +217,7 @@ namespace smt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    template<typename Ext>
 | 
					    template<typename Ext>
 | 
				
			||||||
    bool theory_arith<Ext>::valid_assignment() const {
 | 
					    bool theory_arith<Ext>::valid_assignment() const {
 | 
				
			||||||
        if (get_manager().limit().get_cancel_flag())
 | 
					        if (get_manager().limit().is_canceled())
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        if (valid_row_assignment() &&
 | 
					        if (valid_row_assignment() &&
 | 
				
			||||||
            satisfy_bounds() &&
 | 
					            satisfy_bounds() &&
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1811,7 +1811,7 @@ namespace smt {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool theory_bv::check_invariant() {
 | 
					    bool theory_bv::check_invariant() {
 | 
				
			||||||
        if (m.limit().get_cancel_flag())
 | 
					        if (m.limit().is_canceled())
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        if (ctx.inconsistent())
 | 
					        if (ctx.inconsistent())
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3441,7 +3441,7 @@ public:
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
            rational r = get_value(v);
 | 
					            rational r = get_value(v);
 | 
				
			||||||
            TRACE("arith", tout << mk_pp(o, m) << " v" << v << " := " << r << "\n";);
 | 
					            TRACE("arith", tout << mk_pp(o, m) << " v" << v << " := " << r << "\n";);
 | 
				
			||||||
            SASSERT("integer variables should have integer values: " && (!a.is_int(o) || r.is_int() || m.limit().get_cancel_flag()));
 | 
					            SASSERT("integer variables should have integer values: " && (!a.is_int(o) || r.is_int() || m.limit().is_canceled()));
 | 
				
			||||||
            if (a.is_int(o) && !r.is_int()) r = floor(r);
 | 
					            if (a.is_int(o) && !r.is_int()) r = floor(r);
 | 
				
			||||||
            return alloc(expr_wrapper_proc, m_factory->mk_value(r,  m.get_sort(o)));
 | 
					            return alloc(expr_wrapper_proc, m_factory->mk_value(r,  m.get_sort(o)));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2301,7 +2301,7 @@ void theory_seq::validate_fmls(enode_pair_vector const& eqs, literal_vector cons
 | 
				
			||||||
        k.assert_expr(f);
 | 
					        k.assert_expr(f);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    lbool r = k.check();
 | 
					    lbool r = k.check();
 | 
				
			||||||
    if (r != l_false && !m.limit().get_cancel_flag()) {
 | 
					    if (r != l_false && !m.limit().is_canceled()) {
 | 
				
			||||||
        model_ref mdl;
 | 
					        model_ref mdl;
 | 
				
			||||||
        k.get_model(mdl);
 | 
					        k.get_model(mdl);
 | 
				
			||||||
        IF_VERBOSE(0, 
 | 
					        IF_VERBOSE(0, 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,14 +44,12 @@ uint64_t reslimit::count() const {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool reslimit::inc() {
 | 
					bool reslimit::inc() {
 | 
				
			||||||
    ++m_count;
 | 
					    ++m_count;
 | 
				
			||||||
    bool r = (m_cancel == 0 && (m_limit == 0 || m_count <= m_limit)) || m_suspend;
 | 
					    return not_canceled();
 | 
				
			||||||
    return r;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool reslimit::inc(unsigned offset) {
 | 
					bool reslimit::inc(unsigned offset) {
 | 
				
			||||||
    m_count += offset;
 | 
					    m_count += offset;
 | 
				
			||||||
    bool r = (m_cancel == 0 && (m_limit == 0 || m_count <= m_limit)) || m_suspend;
 | 
					    return not_canceled();
 | 
				
			||||||
    return r;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void reslimit::push(unsigned delta_limit) {
 | 
					void reslimit::push(unsigned delta_limit) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,7 +50,8 @@ public:
 | 
				
			||||||
    uint64_t count() const;
 | 
					    uint64_t count() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool suspended() const { return m_suspend;  }
 | 
					    bool suspended() const { return m_suspend;  }
 | 
				
			||||||
    bool get_cancel_flag() const { return m_cancel > 0 && !m_suspend; }
 | 
					    inline bool not_canceled() const { return (m_cancel == 0 && (m_limit == 0 || m_count <= m_limit)) || m_suspend; }
 | 
				
			||||||
 | 
					    inline bool is_canceled() const { return !not_canceled(); }
 | 
				
			||||||
    char const* get_cancel_msg() const;
 | 
					    char const* get_cancel_msg() const;
 | 
				
			||||||
    void cancel();
 | 
					    void cancel();
 | 
				
			||||||
    void reset_cancel();
 | 
					    void reset_cancel();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue