mirror of
https://github.com/Z3Prover/z3
synced 2025-05-06 23:35:46 +00:00
clause_builder should not fail on always-true literals
Otherwise, e.g. when adding axioms, the caller would have to check each literal before adding it.
This commit is contained in:
parent
ebc4df1ece
commit
e005838129
5 changed files with 21 additions and 4 deletions
|
@ -28,10 +28,15 @@ namespace polysat {
|
|||
|
||||
void clause_builder::reset() {
|
||||
m_literals.reset();
|
||||
m_is_tautology = false;
|
||||
SASSERT(empty());
|
||||
}
|
||||
|
||||
clause_ref clause_builder::build() {
|
||||
if (m_is_tautology) {
|
||||
reset();
|
||||
return nullptr;
|
||||
}
|
||||
std::sort(m_literals.data(), m_literals.data() + m_literals.size());
|
||||
sat::literal prev = sat::null_literal;
|
||||
unsigned j = 0;
|
||||
|
@ -56,7 +61,10 @@ namespace polysat {
|
|||
void clause_builder::push(signed_constraint c) {
|
||||
SASSERT(c);
|
||||
SASSERT(c->has_bvar());
|
||||
SASSERT(!c.is_always_true()); // clause would be a tautology
|
||||
if (c.is_always_true()) {
|
||||
m_is_tautology = true;
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
if (c->unit_clause()) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue