Returns true if "self => other" is known at compile time to be true. Returning false does not imply the implication is false, just that we do not know. Important: keep the performance of this function proportional to the size of self.
(&self, other: &Rc<SymbolicValue>)
| 875 | /// |
| 876 | /// Important: keep the performance of this function proportional to the size of self. |
| 877 | fn implies(&self, other: &Rc<SymbolicValue>) -> bool { |
| 878 | // x => true, is always true |
| 879 | // false => x, is always true |
| 880 | // x => x, is always true |
| 881 | if other.as_bool_if_known().unwrap_or(false) |
| 882 | || !self.as_bool_if_known().unwrap_or(true) |
| 883 | || self.eq(other) |
| 884 | { |
| 885 | return true; |
| 886 | } |
| 887 | |
| 888 | // x && y => x |
| 889 | // y && x => x |
| 890 | if let Expression::And { left, right } = &self.expression { |
| 891 | return left.implies(other) || right.implies(other); |
| 892 | } |
| 893 | false |
| 894 | } |
| 895 | |
| 896 | /// Returns true if "self => !other" is known at compile time to be true. |
| 897 | /// Returning false does not imply the implication is false, just that we do not know. |
no test coverage detected