mirror of
				https://github.com/Z3Prover/z3
				synced 2025-11-04 13:29:11 +00:00 
			
		
		
		
	Merge pull request #1862 from kbobyrev/arith_eq_solver-cleanup
[NFC] Cleanup arith_eq_solver.(cpp|h)
This commit is contained in:
		
						commit
						55cc89b6bb
					
				
					 2 changed files with 78 additions and 81 deletions
				
			
		| 
						 | 
				
			
			@ -17,9 +17,6 @@ Author:
 | 
			
		|||
#include "smt/arith_eq_solver.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
arith_eq_solver::~arith_eq_solver() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
arith_eq_solver::arith_eq_solver(ast_manager & m, params_ref const& p):
 | 
			
		||||
    m(m),
 | 
			
		||||
    m_params(p),
 | 
			
		||||
| 
						 | 
				
			
			@ -93,9 +90,9 @@ void arith_eq_solver::gcd_normalize(vector<numeral>& values) {
 | 
			
		|||
    if (g.is_zero() || g.is_one()) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    for (unsigned i = 0; i < values.size(); ++i) {
 | 
			
		||||
        values[i] = values[i] / g;
 | 
			
		||||
        SASSERT(values[i].is_int());
 | 
			
		||||
    for (auto &value : values) {
 | 
			
		||||
        value /= g;
 | 
			
		||||
        SASSERT(value.is_int());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -216,8 +213,8 @@ bool arith_eq_solver::solve_integer_equation(
 | 
			
		|||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    if (a.is_one()) {
 | 
			
		||||
        for (unsigned i = 0; i < values.size(); ++i) {
 | 
			
		||||
            values[i].neg();
 | 
			
		||||
        for (auto &value : values) {
 | 
			
		||||
            value.neg();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    is_fresh = !abs_a.is_one();
 | 
			
		||||
| 
						 | 
				
			
			@ -225,12 +222,12 @@ bool arith_eq_solver::solve_integer_equation(
 | 
			
		|||
    if (is_fresh) {
 | 
			
		||||
 | 
			
		||||
        numeral m = abs_a + numeral(1);
 | 
			
		||||
        for (unsigned i = 0; i < values.size(); ++i) {
 | 
			
		||||
            values[i] = mod_hat(values[i], m);
 | 
			
		||||
        for (auto &value : values) {
 | 
			
		||||
          value = mod_hat(value, m);
 | 
			
		||||
        }
 | 
			
		||||
        if (values[index].is_one()) {
 | 
			
		||||
            for (unsigned i = 0; i < values.size(); ++i) {
 | 
			
		||||
                values[i].neg();
 | 
			
		||||
            for (auto &value : values) {
 | 
			
		||||
                value.neg();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        SASSERT(values[index].is_minus_one());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,7 +35,7 @@ class arith_eq_solver {
 | 
			
		|||
 | 
			
		||||
    void prop_mod_const(expr * e, unsigned depth, numeral const& k, expr_ref& result);
 | 
			
		||||
 | 
			
		||||
    bool gcd_test(vector<numeral>& value);
 | 
			
		||||
    bool gcd_test(vector<numeral>& values);
 | 
			
		||||
    unsigned find_abs_min(vector<numeral>& values);
 | 
			
		||||
    void gcd_normalize(vector<numeral>& values);
 | 
			
		||||
    void substitute(vector<numeral>& r, vector<numeral> const& s, unsigned   index);
 | 
			
		||||
| 
						 | 
				
			
			@ -63,7 +63,7 @@ class arith_eq_solver {
 | 
			
		|||
 | 
			
		||||
public:
 | 
			
		||||
    arith_eq_solver(ast_manager & m, params_ref const& p = params_ref());
 | 
			
		||||
    ~arith_eq_solver();
 | 
			
		||||
    ~arith_eq_solver() = default;
 | 
			
		||||
 | 
			
		||||
    // Integer linear solver for a single equation.
 | 
			
		||||
    // The array values contains integer coefficients
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue