mirror of
https://github.com/Z3Prover/z3
synced 2025-05-04 22:35:45 +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
|
@ -26,6 +26,9 @@ namespace polysat {
|
|||
class clause_builder {
|
||||
solver* m_solver;
|
||||
sat::literal_vector m_literals;
|
||||
/// true iff clause contains a literal that is always true
|
||||
/// (only this specific case of tautology is covered by this flag)
|
||||
bool m_is_tautology = false;
|
||||
|
||||
public:
|
||||
clause_builder(solver& s);
|
||||
|
@ -34,11 +37,12 @@ namespace polysat {
|
|||
clause_builder& operator=(clause_builder const& s) = delete;
|
||||
clause_builder& operator=(clause_builder&& s) = default;
|
||||
|
||||
bool empty() const { return m_literals.empty(); }
|
||||
bool empty() const { return m_literals.empty() && !m_is_tautology; }
|
||||
void reset();
|
||||
|
||||
|
||||
/// Build the clause. This will reset the clause builder so it can be reused.
|
||||
/// Returns nullptr if the clause is a tautology and should not be added to the solver.
|
||||
clause_ref build();
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue