mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	temp
This commit is contained in:
		
							parent
							
								
									22aba74176
								
							
						
					
					
						commit
						a3f999a13e
					
				| @ -207,7 +207,10 @@ pair<CheckResult, vector<string>> BooleanLPSolver::check(vector<Expression> cons | ||||
| 	cout << "--------------" << endl; | ||||
| 
 | ||||
| 	if (state().infeasible) | ||||
| 	{ | ||||
| 		cout << "----->>>>> unsatisfiable" << endl; | ||||
| 		return make_pair(CheckResult::UNSATISFIABLE, vector<string>{}); | ||||
| 	} | ||||
| 
 | ||||
| 	std::vector<std::string> booleanVariables; | ||||
| 	std::vector<Clause> clauses = state().clauses; | ||||
| @ -227,7 +230,10 @@ pair<CheckResult, vector<string>> BooleanLPSolver::check(vector<Expression> cons | ||||
| 	//cout << "Boolean variables:" << joinHumanReadable(booleanVariables) << endl;
 | ||||
| 	//cout << "Running LP solver on fixed constraints." << endl;
 | ||||
| 	if (m_lpSolver.check(lpState).first == LPResult::Infeasible) | ||||
| 	{ | ||||
| 		cout << "----->>>>> unsatisfiable" << endl; | ||||
| 		return {CheckResult::UNSATISFIABLE, {}}; | ||||
| 	} | ||||
| 
 | ||||
| 	auto theorySolver = [&](map<size_t, bool> const& _booleanAssignment) -> optional<Clause> | ||||
| 	{ | ||||
| @ -263,12 +269,12 @@ pair<CheckResult, vector<string>> BooleanLPSolver::check(vector<Expression> cons | ||||
| 	auto optionalModel = CDCL{move(booleanVariables), clauses, theorySolver}.solve(); | ||||
| 	if (!optionalModel) | ||||
| 	{ | ||||
| 		//cout << "==============> CDCL final result: unsatisfiable." << endl;
 | ||||
| 		cout << "==============> CDCL final result: unsatisfiable." << endl; | ||||
| 		return {CheckResult::UNSATISFIABLE, {}}; | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		//cout << "==============> CDCL final result: SATisfiable / UNKNOWN." << endl;
 | ||||
| 		cout << "==============> CDCL final result: SATisfiable / UNKNOWN." << endl; | ||||
| 		// TODO should be "unknown" later on
 | ||||
| 		//return {CheckResult::SATISFIABLE, {}};
 | ||||
| 		return {CheckResult::UNKNOWN, {}}; | ||||
|  | ||||
| @ -69,8 +69,8 @@ optional<CDCL::Model> CDCL::solve() | ||||
| 			cancelUntil(backtrackLevel); | ||||
| 			solAssert(!learntClause.empty()); | ||||
| 			solAssert(!isAssigned(learntClause.front())); | ||||
| 			for (size_t i = 1; i < learntClause.size(); i++) | ||||
| 				solAssert(isAssignedFalse(learntClause.at(i))); | ||||
| //			for (size_t i = 1; i < learntClause.size(); i++)
 | ||||
| //				solAssert(value(learntClause[i]) == TriState{false});
 | ||||
| 
 | ||||
| 			addClause(move(learntClause)); | ||||
| 			enqueue(m_clauses.back()->front(), &(*m_clauses.back())); | ||||
|  | ||||
| @ -85,6 +85,7 @@ void ReasoningBasedSimplifier::operator()(If& _if) | ||||
| 	{ | ||||
| 		cout << "Checking if condition  can be true" << endl; | ||||
| 		m_solver->push(); | ||||
| 		// TODO change this to >= 1 for simplicity?
 | ||||
| 		m_solver->addAssertion(condition != constantValue(0)); | ||||
| 		cout << "  running check" << endl; | ||||
| 		CheckResult result2 = m_solver->check({}).first; | ||||
| @ -99,6 +100,7 @@ void ReasoningBasedSimplifier::operator()(If& _if) | ||||
| 			// Nothing left to be done.
 | ||||
| 			return; | ||||
| 		} | ||||
| 		cout << " unknown :(" << endl; | ||||
| 	} | ||||
| 
 | ||||
| 	m_solver->push(); | ||||
|  | ||||
| @ -344,6 +344,14 @@ BOOST_AUTO_TEST_CASE(pure_boolean) | ||||
| 	infeasible(); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(more_test) | ||||
| { | ||||
| 	Expression x = variable("x"); | ||||
| 	solver.addAssertion(x == 0); | ||||
| 	solver.addAssertion(x != 0); | ||||
| 	infeasible(); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_SUITE_END() | ||||
| 
 | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user