mirror of
				https://github.com/Z3Prover/z3
				synced 2025-10-31 19:52:29 +00:00 
			
		
		
		
	forbidden intervals fixes
This commit is contained in:
		
							parent
							
								
									43fef8e8ba
								
							
						
					
					
						commit
						d36a658139
					
				
					 3 changed files with 14 additions and 5 deletions
				
			
		|  | @ -51,6 +51,7 @@ 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->unit_clause()) { | ||||
|             add_dependency(c->unit_dep()); | ||||
|             m_level = std::max(m_level, c->unit_clause()->level()); | ||||
|  | @ -59,4 +60,11 @@ namespace polysat { | |||
|         m_literals.push_back(c.blit()); | ||||
|     } | ||||
| 
 | ||||
|     void clause_builder::push_new(signed_constraint c) { | ||||
|         if (c.is_always_false())  // filter out trivial constraints such as "4 < 2" (may come in from forbidden intervals)
 | ||||
|             return; | ||||
|         if (!c->has_bvar()) | ||||
|             m_solver->m_constraints.ensure_bvar(c.get()); | ||||
|         push(c); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -51,6 +51,9 @@ namespace polysat { | |||
|         void push(inequality const& i) { | ||||
|             push(i.as_signed_constraint()); | ||||
|         } | ||||
| 
 | ||||
|         /// Push a new constraint. Allocates a boolean variable for the constraint, if necessary.
 | ||||
|         void push_new(signed_constraint c); | ||||
|        | ||||
|         using const_iterator = decltype(m_literals)::const_iterator; | ||||
|         const_iterator begin() const { return m_literals.begin(); } | ||||
|  |  | |||
|  | @ -75,7 +75,7 @@ namespace polysat { | |||
|     */ | ||||
|     void forbidden_intervals::full_interval_conflict(signed_constraint src, signed_constraint neg_cond, clause_builder& lemma) { | ||||
|         SASSERT(neg_cond); | ||||
|         lemma.push(neg_cond); | ||||
|         lemma.push_new(neg_cond); | ||||
|         lemma.push(~src); | ||||
|     } | ||||
| 
 | ||||
|  | @ -158,12 +158,12 @@ namespace polysat { | |||
|             // the level of a literal is when it was assigned. Lemmas could have unassigned literals.
 | ||||
|             signed_constraint c = s.m_constraints.ult(lhs, rhs); | ||||
|             LOG("constraint: " << c); | ||||
|             lemma.push(~c); | ||||
|             lemma.push_new(~c); | ||||
|             // Side conditions
 | ||||
|             // TODO: check whether the condition is subsumed by c?  maybe at the end do a "lemma reduction" step, to try and reduce branching?
 | ||||
|             signed_constraint& neg_cond = records[i].neg_cond; | ||||
|             if (neg_cond) | ||||
|                 lemma.push(std::move(neg_cond)); | ||||
|                 lemma.push_new(std::move(neg_cond)); | ||||
| 
 | ||||
|             lemma.push(~records[i].src); | ||||
|         } | ||||
|  | @ -185,8 +185,6 @@ namespace polysat { | |||
|         // Current only works when degree(v) is at most one on both sides
 | ||||
|         pdd lhs = c->to_ule().lhs(); | ||||
|         pdd rhs = c->to_ule().rhs(); | ||||
|         if (!c.is_positive()) | ||||
|             swap(lhs, rhs); | ||||
|         unsigned const deg1 = lhs.degree(v); | ||||
|         unsigned const deg2 = rhs.degree(v); | ||||
|         if (deg1 > 1 || deg2 > 1) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue