mirror of
				https://github.com/Z3Prover/z3
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Expand always-false check
This commit is contained in:
		
							parent
							
								
									27b31c88d2
								
							
						
					
					
						commit
						e08e124790
					
				
					 3 changed files with 11 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -196,6 +196,7 @@ namespace polysat {
 | 
			
		|||
            break;
 | 
			
		||||
        case l_undef:
 | 
			
		||||
            if (c.is_always_false()) {
 | 
			
		||||
                LOG("Always false: " << c);
 | 
			
		||||
                // asserted an always-false constraint
 | 
			
		||||
                set_conflict_at_base_level();
 | 
			
		||||
                return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -134,17 +134,22 @@ namespace polysat {
 | 
			
		|||
        s.m_viable.intersect(p, q, sc);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool ule_constraint::is_always_false(bool is_positive, pdd const& lhs, pdd const& rhs) const {
 | 
			
		||||
        // TODO: other conditions (e.g. when forbidden interval would be full)
 | 
			
		||||
    bool ule_constraint::is_always_false(bool is_positive, pdd const& lhs, pdd const& rhs) {
 | 
			
		||||
        if (is_positive) {
 | 
			
		||||
            // lhs <= rhs
 | 
			
		||||
            if (rhs.is_zero())
 | 
			
		||||
                return lhs.is_never_zero();
 | 
			
		||||
                return lhs.is_never_zero();  // p <= 0 implies p == 0
 | 
			
		||||
            return lhs.is_val() && rhs.is_val() && lhs.val() > rhs.val();
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            // lhs > rhs
 | 
			
		||||
            if (lhs.is_zero())
 | 
			
		||||
                return true;  // 0 > ... is always false
 | 
			
		||||
            return (lhs.is_val() && rhs.is_val() && lhs.val() <= rhs.val()) || (lhs == rhs);
 | 
			
		||||
            if (lhs == rhs)
 | 
			
		||||
                return true;  // p > p
 | 
			
		||||
            if (lhs.is_one() && rhs.is_never_zero())
 | 
			
		||||
                return true;  // 1 > p implies p == 0
 | 
			
		||||
            return lhs.is_val() && rhs.is_val() && lhs.val() <= rhs.val();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ namespace polysat {
 | 
			
		|||
        pdd const& rhs() const { return m_rhs; }
 | 
			
		||||
        std::ostream& display(std::ostream& out, lbool status) const override;
 | 
			
		||||
        std::ostream& display(std::ostream& out) const override;
 | 
			
		||||
        bool is_always_false(bool is_positive, pdd const& lhs, pdd const& rhs) const;
 | 
			
		||||
        static bool is_always_false(bool is_positive, pdd const& lhs, pdd const& rhs);
 | 
			
		||||
        bool is_always_false(bool is_positive) const override;
 | 
			
		||||
        bool is_currently_false(solver& s, bool is_positive) const override;
 | 
			
		||||
        bool is_currently_true(solver& s, bool is_positive) const override;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue