fn implies()

in checker/src/abstract_value.rs [3028:3055]


    fn implies(&self, other: &Rc<AbstractValue>) -> bool {
        if self.is_bottom() || self.is_top() || other.is_bottom() || other.is_top() {
            return false;
        }

        // x => true, is always true
        // false => x, is always true
        // x => x, is always true
        if other.as_bool_if_known().unwrap_or(false)
            || !self.as_bool_if_known().unwrap_or(true)
            || (self.eq(other))
        {
            return true;
        }

        // x && y => x
        // y && x => x
        if let Expression::And { left, right } = &self.expression {
            return left.implies(other) || right.implies(other);
        }

        // x => x || y
        // x => y || x
        if let Expression::Or { left, right } = &other.expression {
            return self.implies(left) || self.implies(right);
        }
        false
    }